feat(performance): 자동 업데이트 카드 — 시간·간격 칸 글자 너비, 아날로그 시계
- 시간(시·분)·간격 칸이 공용 .erp-input min-width 240px 로 늘어나던 것을 글자 너비만큼으로 - 시간 오른쪽에 12시간 아날로그 시계: 시작·끝 바늘, 그 사이(시계 방향)를 빨갛게, 12시간 넘는 부분은 진한 빨강. 시간을 바꾸면 바로 다시 그림, 마우스를 올리면 "09:00 ~ 19:00 (10시간)" - 브라우저 테스트: 실제 erp.css 로 칸 너비 확인, 시계 부채꼴·눈금·바늘·12시간 초과 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1071,8 +1071,43 @@
|
||||
return "";
|
||||
}
|
||||
function dirty() { msg.textContent = "바뀐 내용이 있습니다 — [저장]을 누르세요."; msg.classList.remove("is-ok"); }
|
||||
// 아날로그 시계(12시간 문자판) — 시작 바늘 ~ 끝 바늘 사이(시계 방향)를 빨갛게, 12시간을 넘는 부분은 진한 빨강으로 한 번 더
|
||||
function drawClock(row) {
|
||||
const svg = row.querySelector(".perf-auto-clock");
|
||||
if (!svg) return;
|
||||
const s = read(row);
|
||||
function mins(hhmm) { const p = hhmm.split(":"); return Number(p[0]) * 60 + Number(p[1]); }
|
||||
const a = mins(s.start), b = mins(s.end), R = 44;
|
||||
function pt(m, r) { const t = (m % 720) / 720 * 2 * Math.PI; return [(r * Math.sin(t)).toFixed(2), (-r * Math.cos(t)).toFixed(2)]; }
|
||||
function sector(from, len, cls) {
|
||||
if (len <= 0) return "";
|
||||
if (len >= 720) return '<circle class="' + cls + '" r="' + R + '"/>';
|
||||
const p0 = pt(from, R), p1 = pt(from + len, R);
|
||||
return '<path class="' + cls + '" d="M0 0L' + p0[0] + " " + p0[1] + "A" + R + " " + R + " 0 " + (len > 360 ? 1 : 0) + " 1 " +
|
||||
p1[0] + " " + p1[1] + 'Z"/>';
|
||||
}
|
||||
let g = '<circle class="c-face" r="47"/>' + sector(a, Math.min(b - a, 720), "c-span") + sector(a + 720, b - a - 720, "c-span2");
|
||||
for (let h = 0; h < 12; h++) {
|
||||
const major = h % 3 === 0, o = pt(h * 60, 46), i = pt(h * 60, major ? 36 : 40);
|
||||
g += '<line class="c-tick' + (major ? " is-major" : "") + '" x1="' + i[0] + '" y1="' + i[1] + '" x2="' + o[0] + '" y2="' + o[1] + '"/>';
|
||||
}
|
||||
const hs = pt(a, 30), he = pt(b, 38);
|
||||
g += '<line class="c-hand" x1="0" y1="0" x2="' + hs[0] + '" y2="' + hs[1] + '"/>' +
|
||||
'<line class="c-hand is-end" x1="0" y1="0" x2="' + he[0] + '" y2="' + he[1] + '"/><circle class="c-pin" r="3.5"/>';
|
||||
const span = b - a, hours = Math.floor(span / 60), rest = span % 60;
|
||||
const title = s.start + " ~ " + s.end + " (" + (hours ? hours + "시간" : "") + (rest ? (hours ? " " : "") + rest + "분" : "") + (span ? "" : "한 번") + ")";
|
||||
svg.innerHTML = "<title>" + title + "</title>" + g;
|
||||
svg.setAttribute("aria-label", "자동 업데이트 시간대 " + title);
|
||||
}
|
||||
card.querySelectorAll(".perf-auto-row").forEach(function (row) {
|
||||
row.addEventListener("change", function () { row.classList.toggle("is-off", !read(row).enabled); dirty(); });
|
||||
const tf = row.querySelector('[data-t="end-m"]').closest(".perf-auto-field");
|
||||
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
||||
svg.setAttribute("class", "perf-auto-clock");
|
||||
svg.setAttribute("viewBox", "-50 -50 100 100");
|
||||
svg.setAttribute("role", "img");
|
||||
tf.appendChild(svg);
|
||||
drawClock(row);
|
||||
row.addEventListener("change", function () { row.classList.toggle("is-off", !read(row).enabled); drawClock(row); dirty(); });
|
||||
row.querySelectorAll("[data-days]").forEach(function (b) {
|
||||
b.addEventListener("click", function () {
|
||||
row.querySelectorAll("[data-day]").forEach(function (c) {
|
||||
|
||||
Reference in New Issue
Block a user