From fb5aee7ea229b7aae2a162001e92fd06238784ad Mon Sep 17 00:00:00 2001 From: umsangdon Date: Mon, 28 Sep 2026 20:22:06 +0900 Subject: [PATCH] =?UTF-8?q?=EF=BB=BFfix(M02):=20=EC=98=9B=20=EC=95=8C?= =?UTF-8?q?=EC=95=BD=20=EC=97=B0=EA=B2=B0=20=EC=9D=B4=EB=A6=84+=EB=8B=A8?= =?UTF-8?q?=EC=9C=84=EB=A1=9C=20=EB=A7=9E=EC=B6=A4=20=C2=B7=20=EC=98=86=20?= =?UTF-8?q?=ED=8C=90=20=EC=9D=B4=EC=9D=80=20=EC=B9=B8=20=EC=A6=89=EC=8B=9C?= =?UTF-8?q?=20=EA=B0=B1=EC=8B=A0=20=C2=B7=20=EC=83=88=20=EC=A1=B0=ED=95=A9?= =?UTF-8?q?=20=EC=9D=B4=EB=A6=84=20=EA=B2=B9=EC=B9=A8=20=C2=B7=20=EC=B2=AB?= =?UTF-8?q?=20=EC=9E=90=EC=9E=AC=20=EC=A1=B0=ED=95=A9=20=EB=AA=A8=EB=8B=AC?= =?UTF-8?q?=20=EA=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 알약 막대: 키가 목록에 없는 옛 연결(로직 키)을 이름 + 단위가 같은 알약으로 이어 새 키로 바꿈 — 따로 붙던 「연결」 알약 제거 - 재료산출 옆 판: 알약을 이음 · 풂 즉시 「이은 칸」 갱신 - 새 조합 이름: 원래 이름이 구조물 이름으로 끝나면 덧붙이지 않음(일위대가 · 자재) - 자재 조합이 없는 열의 첫 생성 모달 글: 「이 열에 새 자재 조합을 만듦」 Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_019Kyw9qnkJ94pC1A4PfpDtA --- A00_Common/spreadsheet/spreadsheet_links.ts | 21 +++++++++++++++++++ .../M02_MasterTemplete_Combo.ts | 6 +++++- .../M02_MasterTemplete_Materials.ts | 17 +++++++++------ .../M02_MasterTemplete_UI_Main.ts | 5 ++++- 4 files changed, 41 insertions(+), 8 deletions(-) diff --git a/A00_Common/spreadsheet/spreadsheet_links.ts b/A00_Common/spreadsheet/spreadsheet_links.ts index 72dde7a1..0be3ca67 100644 --- a/A00_Common/spreadsheet/spreadsheet_links.ts +++ b/A00_Common/spreadsheet/spreadsheet_links.ts @@ -231,8 +231,29 @@ export function mountLinks( return b; } + /** 옛 키(로직 키 등)로 저장된 연결 — 키가 알약 목록에 없으면 이름 + 단위가 같은 알약으로 이어 + * 연결 키를 새 키로 바꿔 둠(다음 저장 때 새 키로 나감 · 안 맞으면 그대로 두어 늘 보임) */ + function align(): void { + if (opts?.모드 !== "입력") return; + const keys = new Set(items.map((i) => i.키)); + const taken = new Set(); + for (const sheet of ctx.book.시트) + for (const l of sheet.연결 ?? []) if (keys.has(l.키)) taken.add(l.키); + for (const sheet of ctx.book.시트) + for (const l of sheet.연결 ?? []) { + if (keys.has(l.키)) continue; + const hit = items.find( + (i) => !taken.has(i.키) && i.이름 === l.이름 && (i.단위 ?? "") === (l.단위 ?? ""), + ); + if (!hit) continue; + l.키 = hit.키; + taken.add(hit.키); + } + } + function renderBar(): void { if (!opts) return; + align(); const map = found(); const shown: LinkItem[] = []; const seen = new Set(); diff --git a/M02_MasterTemplete/M02_MasterTemplete_Combo.ts b/M02_MasterTemplete/M02_MasterTemplete_Combo.ts index 873ebeb9..1fe94d9f 100644 --- a/M02_MasterTemplete/M02_MasterTemplete_Combo.ts +++ b/M02_MasterTemplete/M02_MasterTemplete_Combo.ts @@ -95,6 +95,10 @@ export function askBranch(message: string, defaultName: string): Promise + !original ? label : !label || original.endsWith(label) ? original : `${original} · ${label}`; + /** 결과 알림 — 새로 만듦 / 같은 조합 씀 */ export const branchToast = (r: BranchedCombo): void => showToast(fill(r.새로만듦 ? TEXT.made : TEXT.reused, `${r.키} ${r.이름}`), "success"); @@ -236,7 +240,7 @@ export async function buildComboBar(opts: ComboBarOptions): Promise void; + /** 연결이 바뀜(이음 · 풂 · 되돌리기) — 이은 칸을 다시 그림 */ + refresh: () => void; } export interface MaterialPanelOptions { @@ -272,11 +275,12 @@ export function buildMaterialPanel(opts: MaterialPanelOptions): MaterialPanel { if (sig(items) !== sig(saved)) { const apply = createButton({ label: TEXT.apply, variant: "filled", size: "sm" }); apply.addEventListener("click", async () => { - const message = others ? fill(TEXT.askBody, { n: others + 1 }) : TEXT.askAlone; - const name = await askBranch( - message, - `${combo?.이름 ?? ""} · ${opts.label}`.replace(/^ · /, ""), - ); + const message = !key + ? TEXT.askFirst + : others + ? fill(TEXT.askBody, { n: others + 1 }) + : TEXT.askAlone; + const name = await askBranch(message, branchName(combo?.이름 ?? "", opts.label)); if (name === null) return; apply.disabled = true; try { @@ -318,5 +322,6 @@ export function buildMaterialPanel(opts: MaterialPanelOptions): MaterialPanel { items = [...list]; paint(); }, + refresh: paint, }; } diff --git a/M02_MasterTemplete/M02_MasterTemplete_UI_Main.ts b/M02_MasterTemplete/M02_MasterTemplete_UI_Main.ts index 93e60594..207d4218 100644 --- a/M02_MasterTemplete/M02_MasterTemplete_UI_Main.ts +++ b/M02_MasterTemplete/M02_MasterTemplete_UI_Main.ts @@ -217,7 +217,10 @@ export function createMain(isAdmin: boolean, onSaved?: () => void): MainHandle { { readOnly, tabs: false, // 시트 하나 · 탭 줄 없음 - onChange: () => (dirty = !readOnly), + onChange: () => { + dirty = !readOnly; + matPanel?.refresh(); // 알약을 이음 · 풂 — 옆 판 「이은 칸」 바로 갱신 + }, links, }, );