fix(B05·B06): 고르기 모달 [해제] 가 [저장] 에서 사라지던 흠 · 항목 더하기 창 빈 칸 안내 (PLAN 26장)
- 구조물 저장은 세션 초안을 보냄(횡단 보기에서 한 지정 · 해제가 종단 보기 메모리 때문에 사라지던 것) - 관 시설 보관소는 서버 응답을 정본으로(집계 항목 칸이 없으면 미지정 · 옛 지정이 되살아나던 것) - 항목 더하기 · 새 항목 창: 빈 이름 · 빈 단위에 칸 빨간 테두리 + 한 줄 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EauA2ATmqNRbeV48s9CcBr
This commit is contained in:
@@ -4,13 +4,7 @@
|
||||
* 모두 약속(Promise)으로 답함 — 닫기 · Esc · 바깥 누르기 = 취소(null / "cancel").
|
||||
* ========================================================================== */
|
||||
|
||||
import {
|
||||
createButton,
|
||||
createInputField,
|
||||
createSelectField,
|
||||
el,
|
||||
showToast,
|
||||
} from "@ui/ui_template_elements";
|
||||
import { createButton, createInputField, createSelectField, el } from "@ui/ui_template_elements";
|
||||
import { t as L } from "@ui/ui_template_locale";
|
||||
import { openModal } from "@ui/ui_template_modal";
|
||||
|
||||
@@ -18,7 +12,7 @@ export interface TextField {
|
||||
key: string;
|
||||
label: string;
|
||||
value?: string;
|
||||
/** 비워도 됨(항목 단위) */
|
||||
/** 비워도 됨 — 아니면 비운 채 [확인] 하면 그 칸에 안내 글 */
|
||||
optional?: boolean;
|
||||
}
|
||||
|
||||
@@ -47,16 +41,22 @@ export function askText(
|
||||
}));
|
||||
const ok = createButton({ label: okLabel, variant: "filled" });
|
||||
const submit = (): void => {
|
||||
// 빈 칸은 그 칸에 빨간 테두리 + 한 줄(칸마다) — 토스트는 창 뒤에 가려 안 보였음
|
||||
const out: Record<string, string> = {};
|
||||
let bad = false;
|
||||
for (const { f, field } of inputs) {
|
||||
out[f.key] = field.input.value.trim();
|
||||
if (!out[f.key] && !f.optional) return showToast(L("M02_NameNeeded"), "error");
|
||||
const empty = !out[f.key] && !f.optional;
|
||||
field.setError(empty ? L("M02_FieldNeeded").replace("{label}", f.label) : undefined);
|
||||
bad ||= empty;
|
||||
}
|
||||
if (bad) return;
|
||||
finish(out);
|
||||
close();
|
||||
};
|
||||
ok.addEventListener("click", submit);
|
||||
for (const { field } of inputs) {
|
||||
field.input.addEventListener("input", () => field.setError(undefined));
|
||||
field.input.addEventListener("keydown", (event) => {
|
||||
if (event.key === "Enter" && !event.isComposing) submit();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user