feat(project,performance): 보드 카드 끌기 실시간 미리보기 · 회의록 항목 끌어 옮기기·검정 테두리 · 실적 매출 단위·광고비(ROAS%) 줄
[프로젝트]
- 보드 카드 끌기: 기울어진 끄는 모양 + 점선 자리 표시가 카드 사이로 FLIP 애니메이션, 놓은 자리 그대로(다른 섹션도 순서 저장)
- 컬럼 dragenter 도 허용 — 자리 표시가 들어온 직후 놓을 때 drop 이 거부되던 문제
- 끄는 동안 실시간 동기화가 보드를 다시 그리지 않음
- 주간 회의록 항목 칸을 끌어 위아래로 이동(묶인 줄·세로 병합째, 같은 구역) — POST meeting-items/{id}/move-to
- 주간 회의록 표 테두리 모두 검정
- 도움말·모듈 문서 갱신
[실적]
- 설정의 쇼핑몰 원본 데이터 확인·카페24 매출 대조·일별 한 번에 비교 카드 삭제(서버 API 는 유지)
- 보기 설정: 매출 단위 원·천원·백만원(이 브라우저 쿠키 perf_unit)
- 매출 실적 표 매출 칸 아래 광고비(ROAS%) 줄(광고비 색), 카페24 는 구글·메타 두 줄
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+287
-26
@@ -4746,26 +4746,31 @@
|
||||
// 보드 드롭(전체보기) — 컬럼 이름(세션명)으로 옮긴다. 업무가 속한 '그
|
||||
// 프로젝트'의 동일 이름 세션 id 를 찾아 적용(프로젝트마다 세션 id 가 다르다).
|
||||
function enableDropByName(body, name) {
|
||||
body.addEventListener("dragover", function (e) {
|
||||
if (!e.dataTransfer.types.includes("text/plain")) return;
|
||||
e.preventDefault(); body.classList.add("is-over");
|
||||
// 전체 보기는 프로젝트마다 섹션이 달라 순서를 못 정한다 — 자리 표시는 섹션 맨 끝(제 섹션은 원래 자리)
|
||||
wireCardPhOver(body, function () { return false; });
|
||||
// dragenter 도 받아 둔다 — 자리 표시가 마우스 아래로 들어온 직후(다음 dragover 전) 놓아도 놓기가 거부되지 않게
|
||||
["dragenter", "dragover"].forEach(function (kind) {
|
||||
body.addEventListener(kind, function (e) {
|
||||
if (!e.dataTransfer.types.includes("text/plain")) return;
|
||||
e.preventDefault(); e.dataTransfer.dropEffect = "move";
|
||||
});
|
||||
});
|
||||
body.addEventListener("dragleave", function () { body.classList.remove("is-over"); });
|
||||
body.addEventListener("drop", async function (e) {
|
||||
if (!e.dataTransfer.types.includes("text/plain")) return;
|
||||
e.preventDefault();
|
||||
body.classList.remove("is-over");
|
||||
const taskId = parseInt(e.dataTransfer.getData("text/plain"), 10);
|
||||
const t = tasks.find(function (x) { return x.id === taskId; });
|
||||
if (!t || (t.stage_name || "") === name) return;
|
||||
if (!t || (t.stage_name || "") === name) { endCardDrag(true); return; }
|
||||
const plist = stagesByProject[t.project_id] || [];
|
||||
const target = plist.find(function (s) { return s.name === name; });
|
||||
if (!target) { alert("'" + (t.project_name || "이 프로젝트") + "' 에는 '" + name + "' 섹션이 없습니다."); return; }
|
||||
if (!target) { endCardDrag(true); alert("'" + (t.project_name || "이 프로젝트") + "' 에는 '" + name + "' 섹션이 없습니다."); return; }
|
||||
if (cardDrag) cardDrag.dropped = true;
|
||||
try {
|
||||
const res = await api("PUT", "/project/api/tasks/" + taskId, { stage_id: target.id });
|
||||
mergeTask(res.task);
|
||||
renderBoard();
|
||||
} catch (err) { alert("이동 실패: " + err.message); }
|
||||
endCardDrag(true);
|
||||
renderBoard();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5206,52 +5211,195 @@
|
||||
}
|
||||
return cards.length;
|
||||
}
|
||||
function enableDropByStageId(body, stageId) {
|
||||
body.addEventListener("dragover", function (e) {
|
||||
if (!e.dataTransfer.types.includes("text/plain")) return;
|
||||
e.preventDefault(); body.classList.add("is-over");
|
||||
// ── 카드 끌기 실시간 미리보기(2026-10-19) — 끄는 동안 카드 자리는 비우고(자리 표시
|
||||
// .pj-card-ph), 마우스가 카드 사이를 지나는 순간 자리 표시가 그 사이로 옮겨 가며 다른 카드가
|
||||
// 미끄러지듯 비켜난다(FLIP 애니메이션). 놓으면 자리 표시가 있던 곳에 그대로 들어간다 —
|
||||
// 섹션 안·다른 섹션 모두. 끄는 카드는 살짝 기울어진 그림자 카드로 마우스를 따라간다.
|
||||
// 필터·정렬 중이거나 전체 보기(섹션 이름 보드)면 순서를 못 정하므로 원래 자리/섹션 맨 끝만.
|
||||
let cardDrag = null; // { t, card, ph, fromBody, origIdx, dropped }
|
||||
function phCards(body) {
|
||||
return Array.prototype.filter.call(body.children, function (c) {
|
||||
return c.classList.contains("pj-card") && c.dataset.taskId && (!cardDrag || c !== cardDrag.card);
|
||||
});
|
||||
}
|
||||
function phIndex(body) { // 자리 표시 앞에 있는 카드 수 = 놓을 자리
|
||||
const ph = cardDrag && cardDrag.ph;
|
||||
if (!ph || ph.parentNode !== body) return -1;
|
||||
return phCards(body).filter(function (c) { return c.compareDocumentPosition(ph) & Node.DOCUMENT_POSITION_FOLLOWING; }).length;
|
||||
}
|
||||
function startCardDrag(e, card, t) {
|
||||
endCardDrag(true);
|
||||
const body = card.parentNode;
|
||||
if (!body || !body.classList.contains("pj-col-body")) return;
|
||||
// 끄는 모양 — 카드 복제를 살짝 기울여 그림자와 함께(화면 배율 밖 body 에 잠깐 붙였다 뗀다)
|
||||
try {
|
||||
const r = card.getBoundingClientRect();
|
||||
const ghost = document.createElement("div");
|
||||
ghost.className = "pj-card-ghost";
|
||||
const clone = card.cloneNode(true);
|
||||
clone.classList.remove("is-dragging");
|
||||
clone.style.width = card.offsetWidth + "px";
|
||||
ghost.appendChild(clone);
|
||||
if (document.documentElement.classList.contains("pj-ui-scale")) ghost.style.zoom = "0.75";
|
||||
document.body.appendChild(ghost);
|
||||
e.dataTransfer.setDragImage(ghost, Math.max(0, e.clientX - r.left) + 14, Math.max(0, e.clientY - r.top) + 14);
|
||||
setTimeout(function () { ghost.remove(); }, 0);
|
||||
} catch (_) {}
|
||||
const ph = document.createElement("div");
|
||||
ph.className = "pj-card-ph";
|
||||
ph.style.height = card.offsetHeight + "px";
|
||||
// (cardDrag 를 정하기 전이라 phCards 에 끄는 카드도 들어 있다 — 그 순번 = 나머지 카드 중 원래 자리)
|
||||
cardDrag = { t: t, card: card, ph: ph, fromBody: body, origIdx: phCards(body).indexOf(card), dropped: false };
|
||||
document.documentElement.classList.add("pj-card-dragging");
|
||||
// 끌기 그림이 찍힌 뒤에 원래 카드를 숨기고 그 자리에 자리 표시(같은 틱에 숨기면 크롬이 끌기를 취소)
|
||||
const cur = cardDrag;
|
||||
setTimeout(function () {
|
||||
if (cardDrag !== cur || !card.isConnected) return;
|
||||
card.parentNode.insertBefore(ph, card);
|
||||
card.classList.add("is-drag-src");
|
||||
}, 0);
|
||||
}
|
||||
function endCardDrag(force) {
|
||||
const d = cardDrag;
|
||||
if (!d) return;
|
||||
if (d.dropped && !force) return; // 놓은 뒤 저장 중 — 저장이 끝나면 다시 그리며 정리
|
||||
cardDrag = null;
|
||||
document.documentElement.classList.remove("pj-card-dragging");
|
||||
d.ph.remove();
|
||||
d.card.classList.remove("is-drag-src", "is-dragging");
|
||||
document.querySelectorAll(".pj-col-body.is-over").forEach(function (b) { b.classList.remove("is-over"); });
|
||||
}
|
||||
// 레이아웃 바꾸기 전후 위치 차이만큼 되돌렸다가 0 으로 — 비켜나는 카드가 미끄러지는 효과.
|
||||
function flipBoardCards(bodies, mutate) {
|
||||
const nodes = [];
|
||||
bodies.forEach(function (b) {
|
||||
if (!b) return;
|
||||
Array.prototype.forEach.call(b.children, function (c) {
|
||||
if ((c.classList.contains("pj-card") || c.classList.contains("pj-card-ph")) && nodes.indexOf(c) < 0) nodes.push(c);
|
||||
});
|
||||
});
|
||||
const first = nodes.map(function (n) { const r = n.getBoundingClientRect(); return [r.left, r.top]; });
|
||||
mutate();
|
||||
nodes.forEach(function (n, i) {
|
||||
if (!n.isConnected || n.classList.contains("is-drag-src")) return;
|
||||
const r = n.getBoundingClientRect();
|
||||
const dx = first[i][0] - r.left, dy = first[i][1] - r.top;
|
||||
if (!dx && !dy) return;
|
||||
n.style.transition = "none";
|
||||
n.style.transform = "translate(" + dx + "px," + dy + "px)";
|
||||
});
|
||||
requestAnimationFrame(function () {
|
||||
nodes.forEach(function (n) {
|
||||
if (!n.style.transform) return;
|
||||
n.style.transition = "transform .18s cubic-bezier(.2,.7,.3,1)";
|
||||
n.style.transform = "";
|
||||
setTimeout(function () { if (!n.style.transform) n.style.transition = ""; }, 220);
|
||||
});
|
||||
});
|
||||
}
|
||||
// 마우스 Y 가 이 섹션의 몇 번째 카드 사이인지 — 애니메이션 중인 카드는 움직이기 전 자리로 계산(떨림 방지).
|
||||
function phTargetIndex(body, clientY, ordered) {
|
||||
const cards = phCards(body);
|
||||
if (!ordered) return body === cardDrag.fromBody ? Math.min(cardDrag.origIdx, cards.length) : cards.length;
|
||||
for (let i = 0; i < cards.length; i++) {
|
||||
const r = cards[i].getBoundingClientRect();
|
||||
let ty = 0;
|
||||
if (cards[i].style.transform) { try { ty = new DOMMatrixReadOnly(getComputedStyle(cards[i]).transform).m42; } catch (_) {} }
|
||||
if (clientY < r.top - ty + r.height / 2) return i;
|
||||
}
|
||||
return cards.length;
|
||||
}
|
||||
function placeCardPh(body, clientY, ordered) {
|
||||
if (!cardDrag || !cardDrag.card.classList.contains("is-drag-src")) return;
|
||||
const idx = phTargetIndex(body, clientY, ordered);
|
||||
if (phIndex(body) === idx) return;
|
||||
const ph = cardDrag.ph;
|
||||
const oldBody = ph.parentNode;
|
||||
flipBoardCards([oldBody, body], function () {
|
||||
const cards = phCards(body);
|
||||
if (idx < cards.length) body.insertBefore(ph, cards[idx]);
|
||||
else if (cards.length) cards[cards.length - 1].after(ph);
|
||||
else body.insertBefore(ph, body.querySelector(":scope > .pj-tasknew"));
|
||||
});
|
||||
}
|
||||
function wireCardPhOver(body, ordered) {
|
||||
body.addEventListener("dragover", function (e) {
|
||||
if (!cardDrag || !e.dataTransfer.types.includes("text/plain")) return;
|
||||
placeCardPh(body, e.clientY, ordered());
|
||||
});
|
||||
}
|
||||
function enableDropByStageId(body, stageId) {
|
||||
wireCardPhOver(body, manualOrderAllowed);
|
||||
// dragenter 도 받아 둔다 — 자리 표시가 마우스 아래로 들어온 직후(다음 dragover 전) 놓아도 놓기가 거부되지 않게
|
||||
["dragenter", "dragover"].forEach(function (kind) {
|
||||
body.addEventListener(kind, function (e) {
|
||||
if (!e.dataTransfer.types.includes("text/plain")) return;
|
||||
e.preventDefault(); e.dataTransfer.dropEffect = "move";
|
||||
});
|
||||
});
|
||||
body.addEventListener("dragleave", function () { body.classList.remove("is-over"); });
|
||||
body.addEventListener("drop", async function (e) {
|
||||
if (!e.dataTransfer.types.includes("text/plain")) return;
|
||||
e.preventDefault();
|
||||
body.classList.remove("is-over");
|
||||
const taskId = parseInt(e.dataTransfer.getData("text/plain"), 10);
|
||||
const t = tasks.find(function (x) { return x.id === taskId; });
|
||||
if (!t) return;
|
||||
const t = (cardDrag && cardDrag.t.id === taskId && cardDrag.t) || tasks.find(function (x) { return x.id === taskId; });
|
||||
if (!t) { endCardDrag(true); return; }
|
||||
// 놓을 자리 = 자리 표시 위치(없으면 마우스 위치)
|
||||
let idx = phIndex(body);
|
||||
if (idx < 0) idx = cardDropIndex(body, e.clientY, taskId);
|
||||
// 자리 표시 기준 이 섹션 카드 순서(끈 카드 포함) + 화면에 없는 이 섹션 업무는 뒤에
|
||||
const domIds = phCards(body).map(function (c) { return parseInt(c.dataset.taskId, 10); })
|
||||
.filter(function (id) { return id !== taskId; });
|
||||
domIds.splice(idx, 0, taskId);
|
||||
function orderedFor() {
|
||||
const rest = tasks.filter(function (x) {
|
||||
return x.stage_id === stageId && x.context_project_id === projectId && domIds.indexOf(x.id) < 0;
|
||||
}).map(function (x) { return x.id; });
|
||||
return domIds.concat(rest);
|
||||
}
|
||||
if (t.stage_id === stageId) {
|
||||
if (!manualOrderAllowed()) {
|
||||
showToast("필터·정렬을 쓰는 중에는 카드 순서를 바꿀 수 없습니다. (정렬: 기본, 필터 초기화 후 가능)", "error");
|
||||
endCardDrag(true);
|
||||
return;
|
||||
}
|
||||
// 같은 세션 안에서 카드 위치만 이동 — 세션 이동이 아니라 정렬.
|
||||
const currentOrder = tasks.filter(function (x) { return x.stage_id === stageId; });
|
||||
const idx = cardDropIndex(body, e.clientY, taskId);
|
||||
const withoutDragged = currentOrder.filter(function (x) { return x.id !== taskId; });
|
||||
withoutDragged.splice(idx, 0, t);
|
||||
const orderedIds = withoutDragged.map(function (x) { return x.id; });
|
||||
const beforeIds = currentOrder.map(function (x) { return x.id; });
|
||||
if (beforeIds.join(",") === orderedIds.join(",")) return; // 놓은 자리가 원래 자리와 같으면 아무것도 안 함
|
||||
const beforeIds = tasks.filter(function (x) { return x.stage_id === stageId && x.context_project_id === projectId; })
|
||||
.map(function (x) { return x.id; });
|
||||
const orderedIds = orderedFor();
|
||||
if (beforeIds.join(",") === orderedIds.join(",")) { endCardDrag(true); return; } // 놓은 자리가 원래 자리와 같으면 아무것도 안 함
|
||||
if (cardDrag) cardDrag.dropped = true; // 저장하는 동안 놓은 자리 그대로 보인다
|
||||
try {
|
||||
await api("PUT", "/project/api/projects/" + projectId + "/stages/" + stageId + "/tasks/order",
|
||||
{ ordered_ids: orderedIds });
|
||||
applyStageOrder(stageId, orderedIds);
|
||||
renderBoard();
|
||||
} catch (err) { showToast("순서 변경 실패: " + err.message, "error"); }
|
||||
endCardDrag(true);
|
||||
renderBoard();
|
||||
return;
|
||||
}
|
||||
if (cardDrag) cardDrag.dropped = true;
|
||||
try {
|
||||
if (t.project_id === projectId) {
|
||||
const res = await api("PUT", "/project/api/tasks/" + taskId, { stage_id: stageId });
|
||||
mergeTask(res.task);
|
||||
// 다른 섹션에도 놓은 자리 그대로 — 기본 정렬·필터 없음일 때만 순서 저장(아니면 섹션 맨 끝)
|
||||
if (manualOrderAllowed()) {
|
||||
const orderedIds = orderedFor();
|
||||
try {
|
||||
await api("PUT", "/project/api/projects/" + projectId + "/stages/" + stageId + "/tasks/order",
|
||||
{ ordered_ids: orderedIds });
|
||||
applyStageOrder(stageId, orderedIds);
|
||||
} catch (err) { showToast("섹션은 옮겼지만 순서 저장 실패: " + err.message, "error"); }
|
||||
}
|
||||
} else {
|
||||
await api("POST", "/project/api/tasks/" + taskId + "/links",
|
||||
{ project_id: projectId, stage_id: stageId });
|
||||
t.stage_id = stageId;
|
||||
t.is_linked = true;
|
||||
}
|
||||
renderBoard();
|
||||
} catch (err) { showToast("이동 실패: " + err.message, "error"); }
|
||||
endCardDrag(true);
|
||||
renderBoard();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6072,9 +6220,11 @@
|
||||
e.dataTransfer.setData("text/plain", String(t.id));
|
||||
// 왼쪽 프로젝트 목록에 놓으면 다른 프로젝트로 옮기기(원 소속 업무만 — 연결로 보이는 카드는 원 소속에서 옮긴다)
|
||||
if (t.context_project_id === t.project_id || !t.is_linked) e.dataTransfer.setData(TASK_DRAG_TYPE, String(t.id));
|
||||
e.dataTransfer.effectAllowed = "move";
|
||||
card.classList.add("is-dragging");
|
||||
startCardDrag(e, card, t);
|
||||
});
|
||||
card.addEventListener("dragend", function () { card.classList.remove("is-dragging"); });
|
||||
card.addEventListener("dragend", function () { card.classList.remove("is-dragging"); endCardDrag(); });
|
||||
// 세부 업무 줄을 이 카드에 놓으면 이 업무의 세부 업무로 옮긴다.
|
||||
// 원래 상위 업무 카드 위에서는 받지 않는다(제자리).
|
||||
card.addEventListener("dragover", function (e) {
|
||||
@@ -9625,6 +9775,8 @@
|
||||
async function syncOnce() {
|
||||
// 회의록 패널을 보는 동안은 이전 프로젝트 화면의 자동 갱신이 왼쪽 메뉴를 다시 만들지 않게 한다.
|
||||
if (document.querySelector(".pj-meeting-panel-host")) return;
|
||||
// 보드 카드를 끄는 중에는 다시 그리지 않는다(자리 표시·끄는 카드가 사라짐) — 다음 주기에 반영
|
||||
if (document.documentElement.classList.contains("pj-card-dragging")) return;
|
||||
if (syncing || observed === null || observed === applied) return;
|
||||
syncing = true;
|
||||
const target = observed;
|
||||
@@ -12381,6 +12533,115 @@
|
||||
showContextMenu(x, y, items.concat(cellGrid ? [null].concat(cellGrid.widthItems(tr.querySelector("th.pj-meet-c-label"))) : []));
|
||||
}
|
||||
|
||||
// ── 항목 칸 끌어 옮기기(2026-10-19) — 항목 칸을 잡고 위아래로 끌면 그 묶음(같은 항목 칸으로 이어 붙은 줄 + 걸친 세로 병합)이
|
||||
// 마우스를 따라 같은 구역의 묶음 사이로 실시간으로 옮겨 가고, 다른 줄은 미끄러지듯 비켜난다. 놓으면 move-to 저장 후
|
||||
// 표를 다시 그린다(실패하면 서버 순서로 되돌림). Esc = 취소. 살짝 누르기만 하면(5px 미만) 예전처럼 이름 수정.
|
||||
if (canEdit) {
|
||||
let press = null, rowDrag = null, noClickUntil = 0;
|
||||
const meetUnits = function (tbody) { // 묶음 = 항목 칸 첫 줄부터(이어 붙은 줄·병합에 가려진 줄은 앞 묶음에)
|
||||
const rows = Array.from(tbody.rows), covered = new Set(), out = [];
|
||||
rows.forEach(function (tr, k) {
|
||||
tr.querySelectorAll("td[data-meet-item]").forEach(function (td) {
|
||||
for (let n = 1; n < (td.rowSpan || 1); n++) covered.add(k + n);
|
||||
});
|
||||
});
|
||||
rows.forEach(function (tr, k) {
|
||||
const start = !out.length || (tr.dataset.labelCont !== "1" && tr.querySelector("th.pj-meet-c-label") && !covered.has(k));
|
||||
if (start) out.push([tr]); else out[out.length - 1].push(tr);
|
||||
});
|
||||
return out;
|
||||
};
|
||||
const applyUnits = function (order) { // 줄을 이 순서로 다시 끼우고 FLIP(칸 단위 — 구분 칸은 첫 줄에 고정)
|
||||
const d = rowDrag, cells = [];
|
||||
d.tbody.querySelectorAll("tr > th, tr > td").forEach(function (c) {
|
||||
if (c !== d.secTh) cells.push([c, c.getBoundingClientRect().top]);
|
||||
});
|
||||
order.forEach(function (u) { u.forEach(function (tr) { d.tbody.appendChild(tr); }); });
|
||||
const first = d.tbody.rows[0];
|
||||
if (d.secTh && d.secTh.parentElement !== first) first.insertBefore(d.secTh, first.firstChild);
|
||||
d.units = order;
|
||||
if (!Element.prototype.animate) return;
|
||||
cells.forEach(function (p) {
|
||||
const dy = p[1] - p[0].getBoundingClientRect().top;
|
||||
if (Math.abs(dy) > 0.5) {
|
||||
p[0].animate([{ transform: "translateY(" + dy + "px)" }, { transform: "none" }],
|
||||
{ duration: 170, easing: "cubic-bezier(.2,.7,.3,1)" });
|
||||
}
|
||||
});
|
||||
};
|
||||
const endRowDrag = function (cancel) {
|
||||
const d = rowDrag;
|
||||
rowDrag = null;
|
||||
press = null;
|
||||
if (!d) return null;
|
||||
if (cancel && d.tbody.isConnected) { rowDrag = d; applyUnits(d.start); rowDrag = null; }
|
||||
d.me.forEach(function (tr) { tr.classList.remove("is-meet-dragging"); });
|
||||
document.documentElement.classList.remove("pj-meet-row-dragging");
|
||||
noClickUntil = Date.now() + 350;
|
||||
return d;
|
||||
};
|
||||
table.addEventListener("mousedown", function (e) {
|
||||
if (e.button !== 0 || rowDrag) return;
|
||||
const th = e.target.closest("tbody.pj-meet-sec th.pj-meet-c-label");
|
||||
if (!th || e.target.closest("button, .is-editing, .pj-meet-colresize")) return;
|
||||
press = { th: th, x: e.clientX, y: e.clientY };
|
||||
});
|
||||
document.addEventListener("mousemove", function (e) {
|
||||
if (!press) return;
|
||||
if (!rowDrag) {
|
||||
if (Math.abs(e.clientY - press.y) < 5 || !press.th.isConnected) return;
|
||||
const tr = press.th.parentElement, tbody = tr.closest("tbody");
|
||||
const units = meetUnits(tbody);
|
||||
const me = units.find(function (u) { return u.indexOf(tr) >= 0; });
|
||||
if (!me || units.length < 2) { press = null; return; }
|
||||
rowDrag = { tbody: tbody, units: units, start: units.slice(), me: me, secTh: tbody.querySelector("th.pj-meet-c-sec") };
|
||||
me.forEach(function (r) { r.classList.add("is-meet-dragging"); });
|
||||
document.documentElement.classList.add("pj-meet-row-dragging");
|
||||
try { window.getSelection().removeAllRanges(); } catch (_) {}
|
||||
}
|
||||
e.preventDefault();
|
||||
const d = rowDrag;
|
||||
if (!d.tbody.isConnected) { endRowDrag(false); return; } // 그 사이 표를 다시 그림
|
||||
const others = d.units.filter(function (u) { return u !== d.me; });
|
||||
let idx = others.length;
|
||||
for (let i = 0; i < others.length; i++) {
|
||||
const top = others[i][0].getBoundingClientRect().top;
|
||||
const bottom = others[i][others[i].length - 1].getBoundingClientRect().bottom;
|
||||
if (e.clientY < (top + bottom) / 2) { idx = i; break; }
|
||||
}
|
||||
const order = others.slice();
|
||||
order.splice(idx, 0, d.me);
|
||||
if (order.every(function (u, k) { return u === d.units[k]; })) return;
|
||||
applyUnits(order);
|
||||
});
|
||||
document.addEventListener("mouseup", function () {
|
||||
const d = endRowDrag(false);
|
||||
if (!d || !d.tbody.isConnected) return;
|
||||
const k = d.units.indexOf(d.me);
|
||||
if (k === d.start.indexOf(d.me)) return; // 제자리
|
||||
const next = d.units[k + 1];
|
||||
const moveId = d.me[0].dataset.item, before = next ? parseInt(next[0].dataset.item, 10) : null;
|
||||
run(async function () {
|
||||
try {
|
||||
await api("POST", itemUrl(moveId) + "/move-to", { before_item_id: before });
|
||||
} catch (err) {
|
||||
showToast("옮기지 못했습니다: " + err.message, "error");
|
||||
await refreshMeeting(); // 서버 순서로 되돌림
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
});
|
||||
document.addEventListener("keydown", function (e) {
|
||||
if (e.key === "Escape" && rowDrag) { e.preventDefault(); e.stopPropagation(); endRowDrag(true); }
|
||||
}, true);
|
||||
window.addEventListener("blur", function () { if (rowDrag) endRowDrag(true); else press = null; });
|
||||
// 끌기를 끝낸 바로 뒤 클릭은 이름 수정으로 넘기지 않는다
|
||||
table.addEventListener("click", function (e) {
|
||||
if (Date.now() < noClickUntil) { e.preventDefault(); e.stopImmediatePropagation(); }
|
||||
}, true);
|
||||
}
|
||||
|
||||
// ── 줄 구조가 바뀐 뒤(줄 추가·삭제·이동·항목 칸 나누기·구역 이동·셀 병합) 새로고침 없이 표의 구역 부분만 서버에서 다시 받아
|
||||
// 그 자리에서 바꿔 끼운다(연간 목표 refreshTable 과 같은 방식) — 지운 줄은 흐려지며 사라지고, 남은 줄은 예전 자리에서
|
||||
// 새 자리로 미끄러지고(FLIP), 새 줄은 위에서 내려오며 잠깐 강조. 동작 줄이기 설정이면 애니메이션 없이.
|
||||
|
||||
Reference in New Issue
Block a user