feat(project): 타임라인에서 하위 작업 펼치기(아사나식)
- 카드의 "N ⤷ ▸" 를 누르면 그 작업의 하위 작업을 받아 바로 아래에 각자 날짜 자리의 작은 카드(점선 테두리, 끌어 옮기기 없음)로 추가, 다시 누르면(▾) 접기. vis order 로 부모 바로 뒤에 쌓이게, 날짜 없는 하위 작업은 안내만 - 하위 작업 카드 더블클릭 = 열기, 우클릭 = 열기 / 상위 작업 열기 - 펼친 상태·받아 둔 하위 작업은 타임라인을 다시 그려도 유지, 작업 창이 닫히면 다시 받는다 - 도움말 13장 갱신, 정적 파일 버전 20260926v Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -507,6 +507,17 @@
|
||||
.pj-tli-due { font-size: 11px; color: #6d6e6f; }
|
||||
.pj-tli-sub { display: inline-flex; align-items: center; gap: 1px; font-size: 11.5px; font-weight: 600; color: #6d6e6f; }
|
||||
.pj-tli-sub svg { width: 13px; height: 13px; }
|
||||
/* 타임라인 하위 작업 펼치기 버튼(N ⤷ ▸) — 누르면 부모 아래에 하위 작업 카드 */
|
||||
.pj-tli-sub.is-toggle { cursor: pointer; border-radius: 5px; padding: 0 1px 0 4px; }
|
||||
.pj-tli-sub.is-toggle:hover { background: rgba(0,0,0,.07); color: #1e1f21; }
|
||||
.pj-tli-sub.is-open { background: color-mix(in srgb, var(--pj-tl-color, #7b68ee) 22%, #fff); color: #1e1f21; }
|
||||
.pj-tli-caret { font-size: 16px; margin-left: -2px; }
|
||||
/* 펼친 하위 작업 카드 — 조금 작게, 점선 테두리(아사나의 하위 작업 묶음 느낌) */
|
||||
#pj-timeline .vis-item.pj-tli-subitem { border-style: dashed !important; border-left-style: solid !important; box-shadow: none; }
|
||||
#pj-timeline .vis-item.pj-tli-subitem .vis-item-content { padding: 2px 7px; }
|
||||
#pj-timeline .vis-item.pj-tli-subitem .pj-tli-title { font-size: 12px; font-weight: 500; }
|
||||
#pj-timeline .vis-item.pj-tli-subitem .pj-tli-av img.pj-avatar { width: 20px; height: 20px; }
|
||||
#pj-timeline .vis-item.pj-tli-subitem .pj-tli-av .pj-gicon { font-size: 20px; }
|
||||
#pj-timeline .vis-item.pj-tli-item.is-done .pj-tli-name { text-decoration: line-through; color: #8f959d; }
|
||||
/* 행(섹션) 이름 — 앞에 섹션 색 네모 */
|
||||
.pj-tlg { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: #1e1f21; padding: 2px 4px; }
|
||||
|
||||
+101
-2
@@ -2594,6 +2594,23 @@
|
||||
});
|
||||
})();
|
||||
|
||||
// 타임라인 하위 작업 펼치기(아사나) — 카드의 "N ⤷" 를 누르면 그 작업 바로 아래에 하위
|
||||
// 작업들이 각자 날짜 자리에 작은 카드로 나온다. 펼친 작업·받아 둔 하위 작업은 타임라인을
|
||||
// 다시 그려도 유지(작업 창이 닫히면 캐시는 비운다 — 거기서 하위 작업을 고쳤을 수 있다).
|
||||
const tlExpanded = new Set();
|
||||
const tlSubCache = {};
|
||||
let tlToggleSubs = null;
|
||||
(function () {
|
||||
const node = el("pj-timeline");
|
||||
if (!node) return;
|
||||
node.addEventListener("click", function (e) {
|
||||
const b = e.target.closest && e.target.closest(".pj-tli-sub[data-task-id]");
|
||||
if (!b) return;
|
||||
e.preventDefault(); e.stopPropagation();
|
||||
if (tlToggleSubs) tlToggleSubs(parseInt(b.dataset.taskId, 10));
|
||||
}, true);
|
||||
})();
|
||||
|
||||
// ── 타임라인 (vis-timeline) — 프로젝트별 행(그룹), 행마다 전체 일정 배경 + 업무 막대 ──
|
||||
function renderTimeline() {
|
||||
const node = el("pj-timeline");
|
||||
@@ -2625,6 +2642,21 @@
|
||||
|
||||
const items = [];
|
||||
const groupRows = [];
|
||||
// 펼친 작업의 하위 작업 → 작은 카드 아이템(날짜 있는 것만, 끌어 옮기기는 안 됨 — 열어서 고친다)
|
||||
function subItemsFor(parent, grp, color) {
|
||||
const pStart = new Date(parent.start_date || parent.due_date).getTime();
|
||||
return (tlSubCache[parent.id] || []).filter(function (s) { return s.start_date || s.due_date; }).map(function (s) {
|
||||
const st = s.start_date || s.due_date, en = s.due_date || s.start_date;
|
||||
const isRange = en !== st;
|
||||
return {
|
||||
id: "sub-" + s.id, group: grp, content: s.title || "",
|
||||
start: st, end: isRange ? en : undefined, type: isRange ? "range" : "point",
|
||||
className: "pj-tli-item pj-tli-subitem" + (s.completed_at ? " is-done" : ""),
|
||||
style: "--pj-tl-color:" + (s.completed_at ? "#9aa5b1" : color) + ";",
|
||||
editable: false, pjTask: s, pjParentId: parent.id, pjParentStart: pStart,
|
||||
};
|
||||
});
|
||||
}
|
||||
const stageById = {};
|
||||
(stagesByProject[projectId] || []).forEach(function (s) { stageById[String(s.id)] = s; });
|
||||
groupOrder.forEach(function (gid) {
|
||||
@@ -2654,8 +2686,10 @@
|
||||
type: isRange ? "range" : "point",
|
||||
className: "pj-tli-item" + (t.completed_at ? " is-done" : ""),
|
||||
style: "--pj-tl-color:" + (t.completed_at ? "#9aa5b1" : groupColor) + ";",
|
||||
pjTask: t,
|
||||
pjTask: t, pjColor: t.completed_at ? "#9aa5b1" : groupColor,
|
||||
pjExpanded: tlExpanded.has(t.id),
|
||||
});
|
||||
if (tlExpanded.has(t.id)) subItemsFor(t, grp, groupColor).forEach(function (x) { items.push(x); });
|
||||
const sm = new Date(startISO).getTime();
|
||||
const em = new Date(endISO).getTime();
|
||||
if (sm < minMs) minMs = sm;
|
||||
@@ -2702,7 +2736,12 @@
|
||||
'<span class="pj-tli-text">' +
|
||||
'<span class="pj-tli-title"><span class="pj-tli-name">' + escapeHtml(t.title || "") + "</span>" +
|
||||
(t.subtask_total
|
||||
? '<span class="pj-tli-sub" title="하위 작업 ' + t.subtask_total + '개">' + t.subtask_total + SUBTASK_ICON_SVG + "</span>"
|
||||
? (item.pjParentId
|
||||
? '<span class="pj-tli-sub" title="하위 작업 ' + t.subtask_total + '개">' + t.subtask_total + SUBTASK_ICON_SVG + "</span>"
|
||||
: '<span class="pj-tli-sub is-toggle' + (item.pjExpanded ? " is-open" : "") + '" data-task-id="' + t.id +
|
||||
'" title="하위 작업 ' + t.subtask_total + "개 " + (item.pjExpanded ? "접기" : "펼치기") + '">' +
|
||||
t.subtask_total + SUBTASK_ICON_SVG +
|
||||
'<span class="material-symbols-outlined pj-tli-caret">' + (item.pjExpanded ? "arrow_drop_down" : "arrow_right") + "</span></span>")
|
||||
: "") +
|
||||
cmtBadge(t) +
|
||||
"</span>" +
|
||||
@@ -2722,6 +2761,17 @@
|
||||
stack: true, height: "520px",
|
||||
template: tlItemEl,
|
||||
groupTemplate: tlGroupEl,
|
||||
// 쌓는 순서: 작업(시작일순) 바로 뒤에 그 작업의 하위 작업들 — 펼친 하위 작업이 부모 아래에 붙는다
|
||||
order: function (a, b) {
|
||||
function key(it) {
|
||||
if (it.pjParentId != null) return [it.pjParentStart, it.pjParentId, 1, new Date(it.start).getTime()];
|
||||
if (it.pjTask) return [new Date(it.start).getTime(), it.id, 0, 0];
|
||||
return [0, 0, 0, 0];
|
||||
}
|
||||
const ka = key(a), kb = key(b);
|
||||
for (let i = 0; i < 4; i++) { if (ka[i] !== kb[i]) return ka[i] < kb[i] ? -1 : 1; }
|
||||
return 0;
|
||||
},
|
||||
horizontalScroll: true, // 마우스 휠 = 좌우 이동(패닝)
|
||||
verticalScroll: false,
|
||||
zoomKey: "ctrlKey", // 확대/축소는 Ctrl+휠
|
||||
@@ -2817,12 +2867,47 @@
|
||||
}
|
||||
timeline.on("changed", paintTLDays);
|
||||
paintTLDays();
|
||||
tlToggleSubs = function (id) {
|
||||
const parent = itemsDS.get(id);
|
||||
if (!parent || !parent.pjTask) return;
|
||||
const subIds = function () { return itemsDS.getIds({ filter: function (it) { return it.pjParentId === id; } }); };
|
||||
if (tlExpanded.has(id)) {
|
||||
tlExpanded.delete(id);
|
||||
itemsDS.remove(subIds());
|
||||
itemsDS.update({ id: id, pjExpanded: false });
|
||||
return;
|
||||
}
|
||||
tlExpanded.add(id);
|
||||
itemsDS.update({ id: id, pjExpanded: true });
|
||||
function addSubs() {
|
||||
if (!tlExpanded.has(id) || !itemsDS.get(id)) return;
|
||||
itemsDS.remove(subIds());
|
||||
const subs = subItemsFor(parent.pjTask, parent.group, parent.pjColor || "#4573d2");
|
||||
itemsDS.add(subs);
|
||||
const undated = (tlSubCache[id] || []).length - subs.length;
|
||||
if (undated > 0) showToast("날짜가 없는 하위 작업 " + undated + "개는 타임라인에 나오지 않습니다.");
|
||||
}
|
||||
if (tlSubCache[id]) { addSubs(); return; }
|
||||
api("GET", "/project/api/tasks/" + id).then(function (res) {
|
||||
tlSubCache[id] = (res && res.task && res.task.subtasks) || [];
|
||||
addSubs();
|
||||
}).catch(function (err) {
|
||||
tlExpanded.delete(id);
|
||||
if (itemsDS.get(id)) itemsDS.update({ id: id, pjExpanded: false });
|
||||
showToast("하위 작업을 불러오지 못했습니다: " + err.message, "error");
|
||||
});
|
||||
};
|
||||
// 다시 그렸는데 펼친 작업의 하위 작업 캐시가 비어 있으면(작업 창을 닫아 비웠다 등) 새로 받는다.
|
||||
Array.from(tlExpanded).forEach(function (id) {
|
||||
if (!tlSubCache[id] && itemsDS.get(id)) { tlExpanded.delete(id); tlToggleSubs(id); }
|
||||
});
|
||||
// 단일 클릭은 선택만(드래그로 기간 조절할 때 양 끝 손잡이가 나타나려면
|
||||
// 먼저 선택 상태여야 한다 — vis 의 자체 동작) — 여기서 모달을 열면
|
||||
// 손잡이가 나타나자마자 모달이 덮어써서 드래그를 할 수가 없다. 편집은
|
||||
// 더블클릭이나 우클릭 메뉴의 "열기"로.
|
||||
timeline.on("doubleClick", function (props) {
|
||||
if (!canManage || props.item == null || String(props.item).indexOf("bg") === 0) return;
|
||||
if (String(props.item).indexOf("sub-") === 0) { openTaskById(parseInt(String(props.item).slice(4), 10)); return; }
|
||||
const t = tasks.find(function (x) { return x.id === props.item; });
|
||||
if (t) openTaskModal(t);
|
||||
});
|
||||
@@ -2830,6 +2915,15 @@
|
||||
timeline.on("contextmenu", function (props) {
|
||||
if (props.event && props.event.preventDefault) props.event.preventDefault();
|
||||
if (!canManage || props.item == null || String(props.item).indexOf("bg") === 0) return;
|
||||
if (String(props.item).indexOf("sub-") === 0) {
|
||||
const subId = parseInt(String(props.item).slice(4), 10);
|
||||
const it = itemsDS.get(props.item);
|
||||
showContextMenu(props.event.clientX, props.event.clientY, [
|
||||
{ label: "열기", onClick: function () { openTaskById(subId); } },
|
||||
{ label: "상위 작업 열기", onClick: function () { if (it) openTaskById(it.pjParentId); } },
|
||||
]);
|
||||
return;
|
||||
}
|
||||
const t = tasks.find(function (x) { return x.id === props.item; });
|
||||
if (t) showContextMenu(props.event.clientX, props.event.clientY, taskContextItems(t));
|
||||
});
|
||||
@@ -4938,6 +5032,11 @@
|
||||
if (!taskModal.hidden) return;
|
||||
Object.keys(subsCache).forEach(function (k) { delete subsCache[k]; });
|
||||
if (expandedSubs.size && currentView === "board") renderBoard();
|
||||
Object.keys(tlSubCache).forEach(function (k) { delete tlSubCache[k]; });
|
||||
if (tlExpanded.size && currentView === "timeline" && tlToggleSubs) {
|
||||
// 펼친 상태는 두고 하위 작업만 새로 받는다
|
||||
Array.from(tlExpanded).forEach(function (id) { tlExpanded.delete(id); tlToggleSubs(id); });
|
||||
}
|
||||
}).observe(taskModal, { attributes: true, attributeFilter: ["hidden"] });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user