feat(M01): 소요량/계수 「쓰는 로직」 키를 누르면 로직 탭에서 그 로직 바로 엶

Logic_Page 에 openKey 초기 인자 + LogicHandle.openKey 추가(이미 연 뒤에도 재호출 가능)
Page.ts 는 복사 안내 대신 로직 탭 전환과 동시에 그 로직을 엶
This commit is contained in:
2026-09-20 23:14:02 +09:00
parent 20bd74306a
commit 0331bb4db2
3 changed files with 29 additions and 15 deletions
+22 -1
View File
@@ -27,6 +27,7 @@ import {
type ElementBrief,
type LogicFile,
type LogicRow,
type LogicSummary,
type SaveFile,
} from "./M01_MasterData_UI_Logic_Api";
import { buildCalc } from "./M01_MasterData_UI_Logic_Calc";
@@ -68,7 +69,16 @@ function loadDrafts(): Record<string, Draft> {
}
}
export async function mountM01Logic(host: HTMLElement, side: SideHandle): Promise<void> {
export interface LogicHandle {
/** 밖(요소 화면)에서 이 키를 바로 엶 — 소요량·계수 표의 「쓰는 로직」 눌렀을 때. */
openKey: (key: string) => Promise<void>;
}
export async function mountM01Logic(
host: HTMLElement,
side: SideHandle,
openKey?: string,
): Promise<LogicHandle> {
let drafts = loadDrafts();
let files: LogicFile[] = [];
let opened: Opened | null = null;
@@ -220,6 +230,8 @@ export async function mountM01Logic(host: HTMLElement, side: SideHandle): Promis
}
};
let allLogics: LogicSummary[] = [];
const reload = async (): Promise<void> => {
const [logics, logicFiles, subs] = await Promise.all([
fetchLogics(),
@@ -227,6 +239,7 @@ export async function mountM01Logic(host: HTMLElement, side: SideHandle): Promis
fetchLogicSubs(),
]);
files = logicFiles;
allLogics = logics;
list.setItems(logics);
// 왼쪽 「전체」 + 구분 → 상세구분 거름 — 고르면 목록으로 돌아와 그 범위만
filterHost.replaceChildren(
@@ -390,11 +403,19 @@ export async function mountM01Logic(host: HTMLElement, side: SideHandle): Promis
side.logicHost.replaceChildren(filterHost);
show(null);
showLoadingOverlay();
const openKeyOn = async (key: string): Promise<void> => {
const found = allLogics.find((x) => x. === key);
if (found) await open(logicId(found., found.), found., found.);
else showToast(tx("Load_Failed"), "error");
};
try {
await reload();
if (openKey) await openKeyOn(openKey);
} catch (error) {
showToast(error instanceof Error ? error.message : tx("Load_Failed"), "error");
} finally {
hideLoadingOverlay();
}
return { openKey: openKeyOn };
}