feat(M01): 로직 열자마자 텍스트 수식 왼쪽 이름 식 채움

로직을 열 때 /text 를 값 없이 한 번 불러 왼쪽 이름 식 칸만 미리 채움
오른쪽 값 식 칸은 [계산] 전까지 안내 글만 표시 · [계산] 뒤엔 지금과 같음
onText 콜백이 redraw 를 안 불러 화면에 안 닿던 것을 찾아 LogicLab.ts 한 줄도 같이 고침(onLines 와 같은 자리)
This commit is contained in:
2026-09-22 20:54:25 +09:00
parent 8187b0a79e
commit abd37e8979
3 changed files with 33 additions and 5 deletions
@@ -12,8 +12,11 @@ import { tx } from "./M01_MasterData_UI_Logic_Text";
import { tl } from "./M01_MasterData_UI_LogicLab_Text";
import "./M01_MasterData_UI_LogicLab_Formula.css";
/** 로직 열자마자 값 없이 부른 미리보기 응답은 `계산됨` 을 false 로 표시 — [계산] 을 거친 응답은 안 붙어 true 취급 */
export type PreviewTextAnswer = TextAnswer & { 계산됨?: boolean };
export interface FormulaContext {
text: TextAnswer | null;
text: PreviewTextAnswer | null;
}
const muted = (text: string): HTMLElement => el("p", { className: "m01-logic__muted", text });
@@ -41,6 +44,7 @@ export function buildFormula(host: HTMLElement, ctx: FormulaContext): void {
],
});
const rows: HTMLElement[] = [];
const calculated = text. !== false; // [계산] 뒤 응답은 표식이 안 붙음 — 미리보기만 false
const light = (pair: string, on: boolean): void =>
rows.forEach((r) => r.dataset.pair === pair && r.classList.toggle("is-on", on));
const blocks = text.groups.flatMap((g) => [
@@ -54,10 +58,14 @@ export function buildFormula(host: HTMLElement, ctx: FormulaContext): void {
el("div", { className: "m01lab-fx__cell", text: line.이름글 ?? line. }),
el("div", {
className: "m01lab-fx__cell",
children: [
el("div", { text: `${line.} : ${line.}` }),
...(line. ? [el("div", { className: "m01-logic__muted", text: line.까닭 })] : []),
],
children: calculated
? [
el("div", { text: `${line.} : ${line.}` }),
...(line.
? [el("div", { className: "m01-logic__muted", text: line.까닭 })]
: []),
]
: [el("div", { className: "m01-logic__muted", text: tl("Formula_Slot") })],
}),
],
});