Merge remote-tracking branches 'origin/sub_laptop_1', 'origin/sub_laptop_2', 'origin/sub_laptop_3' and 'origin/sub_laptop_4' into main_laptop_1

This commit is contained in:
2026-09-29 13:45:24 +09:00
12 changed files with 321 additions and 36 deletions
@@ -91,6 +91,20 @@ def _clean(row: Any, key: str, keep: dict | None = None) -> dict[str, Any]:
}
def _short(name: str, at: int = 30) -> str:
return name if len(name) <= at else name[:at] + "…"
def _check_name(rows: list, key: str, name: str) -> None:
"""이름 겹침 · 긴 이름 — 틀 검사(파일명 · 키가 섞인 글) 앞에서 쉬운 말 한 줄로 막음."""
if len(name) > mmc.MAX_이름:
raise store.StoreError(422, {"errors": [f"이름이 너무 김 — {mmc.MAX_이름}자까지"]})
if any(r.get("키") != key and str(r.get("이름", "")).strip() == name for r in rows):
raise store.StoreError(
422, {"errors": [f"「{_short(name)}」 이름의 자재 조합이 이미 있음 — 다른 이름으로"]}
)
def _save(doc: dict, version: str) -> str:
"""틀 검사 → 판이 같을 때만 씀 → 새 판."""
if errors := mmc.check_form(FILE, doc):
@@ -111,6 +125,7 @@ def create(row: Any, version: str | None = None) -> dict[str, Any]:
fixed = _clean(row, key)
if fixed["본뜬키"] and fixed["본뜬키"] not in {r.get("키") for r in doc["줄"]}:
raise store.StoreError(400, f"본뜬키 「{fixed['본뜬키']}」 — 있는 다른 자재 조합 키여야 함")
_check_name(doc["줄"], key, fixed["이름"])
doc = {**doc, "다음": int(doc.get("다음") or 1) + 1, "줄": [*doc["줄"], fixed]}
return {"키": key, "판": _save(doc, have if version is None else version), "줄": fixed}
@@ -118,6 +133,7 @@ def create(row: Any, version: str | None = None) -> dict[str, Any]:
def edit(key: str, row: Any, version: str) -> dict[str, Any]:
doc, _ = _load()
fixed = _clean(row, key, keep=_find(doc, key))
_check_name(doc["줄"], key, fixed["이름"])
doc = {**doc, "줄": [fixed if r.get("키") == key else r for r in doc["줄"]]}
return {"키": key, "판": _save(doc, version), "줄": fixed}
@@ -354,6 +354,7 @@ export function createMain(
const columns = (): StructureColumn[] => sheet?.getDoc()?.열 ?? [];
editor = create(host, doc, {
mode: at.layer === "project" ? "project" : "master",
readOnly,
onChange: () => (dirty = !readOnly),
...(struct
? {