feat(project): 모든 날짜 칸을 아사나식 날짜 팝업으로(브라우저 기본 달력 제거)
- enhanceDateInput: input[type=date] 를 숨기고 날짜 버튼을 붙여 openDatePopover 를 연다. input 은 값 저장소로 남아 기존 .value·change 코드가 그대로 동작 - 새 프로젝트 마감일, 프로젝트 수정 시작일·마감일(버튼 하나, 팝업의 "+ 시작일"), 하위 작업 추가 줄 마감일에 적용 - 정적 파일 버전 20260925h Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -556,6 +556,18 @@
|
||||
.pj-due-btn.has-date { color: var(--pj-ink); }
|
||||
.pj-due-btn.is-overdue { color: #c22b10; }
|
||||
.pj-due-text:empty { display: none; }
|
||||
/* <input type="date"> 대신 쓰는 아사나식 날짜 버튼(enhanceDateInput) — 누르면 날짜 팝업 */
|
||||
.pj-date-btn {
|
||||
display: inline-flex; align-items: center; gap: 6px; margin-top: 5px; height: 36px; padding: 0 12px;
|
||||
border: 1px solid #d8dce2; border-radius: 8px; background: #fff; cursor: pointer;
|
||||
font-size: 13.5px; font-family: inherit; font-weight: 500; color: var(--pj-ink); white-space: nowrap;
|
||||
}
|
||||
.pj-date-btn .material-symbols-outlined { font-size: 19px; color: #6d6e6f; }
|
||||
.pj-date-btn:hover { background: #f6f7f8; border-color: #c4c9d0; }
|
||||
.pj-date-btn.is-empty { color: #9aa1a9; }
|
||||
.pj-date-btn.is-overdue { color: #c22b10; }
|
||||
/* 하위 작업 추가 줄 안에서는 옆 칸들과 높이를 맞춘다 */
|
||||
.pj-subtask-form .pj-date-btn { margin-top: 0; height: 32px; padding: 0 10px; font-size: 12.5px; }
|
||||
/* 화면엔 안 보이지만 달력이 버튼 자리에 뜨도록 렌더는 유지(display:none 이면 showPicker 불가) */
|
||||
.pj-meta-row-multi .pj-meta-cell-due input.pj-due-native {
|
||||
position: absolute; left: 60px; bottom: 2px; width: 1px !important; height: 1px;
|
||||
|
||||
@@ -393,6 +393,63 @@
|
||||
focusActive();
|
||||
}
|
||||
|
||||
// ── <input type="date"> 를 아사나식 날짜 버튼으로 — 브라우저 기본 달력 대신
|
||||
// 위 openDatePopover 를 연다. input 은 숨겨 값 저장소로 그대로 두므로 기존
|
||||
// 코드의 input.value 읽기/쓰기와 change 이벤트가 그대로 동작한다(value 쓰기를
|
||||
// 가로채 버튼 글자도 따라 바뀐다 — enhanceAssigneeSelect 와 같은 방식).
|
||||
// opts.startInput 을 주면 시작일·마감일을 버튼 하나로(팝업의 "+ 시작일").
|
||||
function enhanceDateInput(input, opts) {
|
||||
if (!input || input.dataset.pjDate) return;
|
||||
opts = opts || {};
|
||||
const startInput = opts.startInput || null;
|
||||
const inputs = startInput ? [startInput, input] : [input];
|
||||
const btn = document.createElement("button");
|
||||
btn.type = "button";
|
||||
btn.className = "pj-date-btn";
|
||||
input.after(btn);
|
||||
const desc = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value");
|
||||
inputs.forEach(function (inp) {
|
||||
inp.dataset.pjDate = "1";
|
||||
inp.style.display = "none";
|
||||
Object.defineProperty(inp, "value", {
|
||||
configurable: true,
|
||||
get: function () { return desc.get.call(this); },
|
||||
set: function (v) { desc.set.call(this, v); sync(); },
|
||||
});
|
||||
});
|
||||
function label(iso) { const di = dueInfo(iso, false); return di ? di.text : ""; }
|
||||
function sync() {
|
||||
const due = input.value, start = startInput ? startInput.value : "";
|
||||
const text = start && due ? label(start) + " – " + label(due)
|
||||
: start ? label(start) + " –" : label(due);
|
||||
const di = dueInfo(due, false);
|
||||
btn.innerHTML = '<span class="material-symbols-outlined">calendar_month</span>' +
|
||||
'<span class="pj-date-btn-text"></span>';
|
||||
btn.querySelector(".pj-date-btn-text").textContent = text || (opts.placeholder || "날짜 선택");
|
||||
btn.classList.toggle("is-empty", !text);
|
||||
btn.classList.toggle("is-overdue", !!di && di.cls === "is-overdue");
|
||||
btn.title = text ? "날짜 변경" : "날짜 지정";
|
||||
}
|
||||
function set(inp, v) {
|
||||
if ((inp.value || "") === (v || "")) return;
|
||||
inp.value = v || "";
|
||||
inp.dispatchEvent(new Event("input", { bubbles: true }));
|
||||
inp.dispatchEvent(new Event("change", { bubbles: true }));
|
||||
}
|
||||
btn.addEventListener("click", function (e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
openDatePopover(btn, {
|
||||
start: startInput ? startInput.value : "", due: input.value, allowStart: !!startInput,
|
||||
onChange: function (patch) {
|
||||
if (startInput) set(startInput, patch.start_date);
|
||||
set(input, patch.due_date);
|
||||
},
|
||||
});
|
||||
});
|
||||
sync();
|
||||
}
|
||||
|
||||
// ── 탭 그룹(뷰 탭/스코프 토글, 둘 다 .pj-view-tabs 마크업 공유)에 슬라이드
|
||||
// 하이라이트를 붙인다 — is-active 를 단순 배경색 대신, 실제 위치가 움직이는
|
||||
// 절대배치 요소 하나로 표현한다. 탭 클릭·초기 렌더·리사이즈마다 위치 재계산.
|
||||
@@ -1075,6 +1132,10 @@
|
||||
});
|
||||
}
|
||||
|
||||
// 프로젝트 모달의 날짜 칸 — 브라우저 기본 달력 대신 아사나식 날짜 팝업.
|
||||
enhanceDateInput(el("pj-f-due"), { placeholder: "마감일 없음" });
|
||||
enhanceDateInput(el("pj-e-due"), { startInput: el("pj-e-start"), placeholder: "날짜 없음" });
|
||||
|
||||
// "+" — 새 최상위 프로젝트. 기본은 만든 프로젝트 화면으로 이동한다.
|
||||
initNewProjectModal(isAdmin, cfg.onCreated || function (project) {
|
||||
location.href = "/project/p/" + project.id;
|
||||
@@ -4947,6 +5008,7 @@
|
||||
const addAssignee = el("pj-subtask-add-assignee");
|
||||
enhanceAssigneeSelect(addAssignee);
|
||||
const addDue = el("pj-subtask-add-due");
|
||||
enhanceDateInput(addDue, { placeholder: "마감일" }); // 아사나식 날짜 팝업
|
||||
const addBtn = el("pj-subtask-add");
|
||||
let taskId = null, projectId = null, canDeleteFn = function () { return false; }, onChange = null, onOpen = null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user