feat(project): 아사나식 머리(제목·탭 2줄)·섹션 추가 위치·팝업 제목 KSN 프로그램
- 프로젝트 제목(색 네모 아이콘+이름)+멤버 / 뷰 탭을 왼쪽 위 2줄로 - "전체 프로젝트" 스코프면 제목을 "전체 프로젝트"로, 멤버 숨김 - "+ 섹션 추가"를 마지막 섹션 바로 오른쪽으로, 위쪽 바 "+ 작업 추가" 제거 - 수신함 오른쪽 작업 창(embed) 맨 위에 "프로젝트로 이동" 버튼 - 하위 작업에 또 하위 작업이 있으면 "N ⤷" 아이콘(작업 창·카드 펼침) - erp-dialog: 화면별 제목(window.ERP_DIALOG_TITLE)·erpPrompt 추가, project.js 의 alert/confirm/prompt 를 공용 창으로(제목 "KSN 프로그램") Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,10 @@
|
||||
쓰는 법 (기본 창과 달리 **비동기**다 — Promise 를 돌려준다):
|
||||
erpConfirm("지울까요?").then(function (ok) { if (ok) ... });
|
||||
erpAlert("실패했습니다.").then(...)
|
||||
erpPrompt("주소를 입력하세요", "https://").then(function (v) { if (v) ... }); // 취소면 null
|
||||
|
||||
창 제목은 기본 "No.1 King ERP 프로그램". 화면마다 바꾸려면 그 화면 스크립트에서
|
||||
window.ERP_DIALOG_TITLE = "..." 를 두거나, 한 번만 options.title 로 넘긴다.
|
||||
|
||||
HTML 만으로 쓰려면 form 에 data-erp-confirm 을 달면 된다. 제출을 가로채
|
||||
확인을 받은 뒤 통과시킨다(가로챈 제출은 form.submit() 으로 다시 보내므로
|
||||
@@ -27,7 +31,12 @@
|
||||
'<circle cx="12" cy="17.1" r="1.05" fill="currentColor"/>' +
|
||||
"</svg>";
|
||||
|
||||
function titleOf(options) {
|
||||
return options.title || window.ERP_DIALOG_TITLE || TITLE;
|
||||
}
|
||||
|
||||
function build(message, options) {
|
||||
var TITLE_TEXT = titleOf(options);
|
||||
var backdrop = document.createElement("div");
|
||||
backdrop.className = "erp-dialog-backdrop";
|
||||
|
||||
@@ -35,11 +44,11 @@
|
||||
box.className = "erp-dialog" + (options.ask ? " erp-dialog-ask" : "");
|
||||
box.setAttribute("role", "alertdialog");
|
||||
box.setAttribute("aria-modal", "true");
|
||||
box.setAttribute("aria-label", TITLE);
|
||||
box.setAttribute("aria-label", TITLE_TEXT);
|
||||
|
||||
var title = document.createElement("h2");
|
||||
title.className = "erp-dialog-title";
|
||||
title.textContent = TITLE;
|
||||
title.textContent = TITLE_TEXT;
|
||||
|
||||
var body = document.createElement("div");
|
||||
body.className = "erp-dialog-body";
|
||||
@@ -54,6 +63,15 @@
|
||||
// HTML 로 해석되지 않게.
|
||||
text.textContent = String(message == null ? "" : message);
|
||||
|
||||
// 입력창(erpPrompt) — 메시지 아래 한 줄.
|
||||
var input = null;
|
||||
if (options.prompt) {
|
||||
input = document.createElement("input");
|
||||
input.type = "text";
|
||||
input.className = "erp-dialog-input";
|
||||
input.value = options.defaultValue == null ? "" : String(options.defaultValue);
|
||||
}
|
||||
|
||||
var actions = document.createElement("div");
|
||||
actions.className = "erp-dialog-actions";
|
||||
|
||||
@@ -76,10 +94,11 @@
|
||||
body.appendChild(text);
|
||||
box.appendChild(title);
|
||||
box.appendChild(body);
|
||||
if (input) box.appendChild(input);
|
||||
box.appendChild(actions);
|
||||
backdrop.appendChild(box);
|
||||
|
||||
return { backdrop: backdrop, box: box, ok: ok, cancel: cancel };
|
||||
return { backdrop: backdrop, box: box, ok: ok, cancel: cancel, input: input };
|
||||
}
|
||||
|
||||
function open(message, options) {
|
||||
@@ -94,7 +113,9 @@
|
||||
document.removeEventListener("keydown", onKey, true);
|
||||
el.backdrop.remove();
|
||||
if (previous && typeof previous.focus === "function") previous.focus();
|
||||
resolve(result);
|
||||
// 입력창이면 확인 = 입력한 글자, 취소 = null
|
||||
if (el.input) resolve(result ? el.input.value : null);
|
||||
else resolve(result);
|
||||
}
|
||||
|
||||
function onKey(e) {
|
||||
@@ -106,7 +127,7 @@
|
||||
close(true);
|
||||
} else if (e.key === "Tab") {
|
||||
// 포커스가 창 밖으로 나가지 않게 두 버튼 사이에서만 돈다.
|
||||
var focusable = el.cancel ? [el.cancel, el.ok] : [el.ok];
|
||||
var focusable = (el.input ? [el.input] : []).concat(el.cancel ? [el.cancel, el.ok] : [el.ok]);
|
||||
var index = focusable.indexOf(document.activeElement);
|
||||
e.preventDefault();
|
||||
var next = e.shiftKey ? index - 1 : index + 1;
|
||||
@@ -125,7 +146,8 @@
|
||||
document.addEventListener("keydown", onKey, true);
|
||||
|
||||
document.body.appendChild(el.backdrop);
|
||||
el.ok.focus();
|
||||
if (el.input) { el.input.focus(); el.input.select(); }
|
||||
else el.ok.focus();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -141,6 +163,14 @@
|
||||
return open(message, opts).then(function () { return undefined; });
|
||||
};
|
||||
|
||||
window.erpPrompt = function (message, defaultValue, options) {
|
||||
var opts = options || {};
|
||||
opts.ask = true;
|
||||
opts.prompt = true;
|
||||
opts.defaultValue = defaultValue;
|
||||
return open(message, opts);
|
||||
};
|
||||
|
||||
// data-erp-confirm 이 달린 폼은 제출 전에 확인을 받는다.
|
||||
document.addEventListener("submit", function (e) {
|
||||
var form = e.target;
|
||||
|
||||
Reference in New Issue
Block a user