Merge remote-tracking branch 'origin/dev' into main_laptop_1

This commit is contained in:
2026-10-01 12:36:32 +09:00
2 changed files with 28 additions and 3 deletions
+23 -1
View File
@@ -6,7 +6,12 @@
* ========================================================================== */
import { createButton, el, showToast } from "@ui/ui_template_elements";
import type { CalcAnswer, CalcLine, LogicInput } from "../M01_MasterData_UI_Logic_Api";
import {
fetchLogics,
type CalcAnswer,
type CalcLine,
type LogicInput,
} from "../M01_MasterData_UI_Logic_Api";
import { formatMoney } from "../M01_MasterData_UI_Logic_Money";
import {
addCard,
@@ -23,6 +28,7 @@ import { setCond, type LbLogic, type LbLookup, type LbRef } from "./M01_LB_Block
import { calcBody, calcView } from "./M01_LB_Steps_Calc";
import {
chip,
logicNames,
lookupValue,
note,
numBox,
@@ -42,6 +48,7 @@ import "./M01_LB_Steps.css";
type Kind = "person" | "material" | "machine" | "logic" | "percent" | "locked";
let picking = false;
let namesLoading = false;
/* ------------------------------ ① 입력값 ------------------------------ */
@@ -367,4 +374,19 @@ export function renderSteps(
),
section(tx("S5"), [el("li", { className: "m01-lbsteps-row", children: [resultView(ctx)] })]),
);
// 다른 일위대가 이름 — 목록을 한 번 받은 뒤 다시 그림
if (
!logicNames.size &&
!namesLoading &&
JSON.stringify([lb.calcs, lb.lookups]).includes('"k":"logic"')
) {
namesLoading = true;
fetchLogics()
.then((all) => {
for (const l of all) logicNames.set(l.키, l.이름);
renderSteps(host, lb, ans, on);
})
.catch(() => undefined)
.finally(() => (namesLoading = false));
}
}
@@ -33,7 +33,7 @@ export const TEXT = {
SrcCalc: ["계산 · ", "calc · "],
SrcFixed: ["고정값", "fixed value"],
SrcAny: ["무관(조건에서 뺌)", "any (remove condition)"],
Other: ["다른 일위대가 결과", "Other unit price result"],
Other: ["다른 일위대가", "Other unit price"],
Hard: ["이 화면에서 못 고치는 값", "Value not editable here"],
Mul: ["×", "×"],
Div: ["÷", "÷"],
@@ -197,6 +197,9 @@ export const isRef = (r: Ref, k: "lookup", id: string): boolean => r.k === k &&
export const lookupNo = (ctx: Ctx, id: string): number =>
ctx.lb.lookups.findIndex((l) => l.id === id) + 1;
/** 로직 이름 — 목록을 한 번 받아 채움(키 → 이름) · 못 받으면 「다른 일위대가」 */
export const logicNames = new Map<string, string>();
export function refText(ctx: Ctx, r: Ref): string {
switch (r.k) {
case "input":
@@ -210,7 +213,7 @@ export function refText(ctx: Ctx, r: Ref): string {
return `${tx("LkNum")}${lookupNo(ctx, r.id)}${lk ? ` · ${lk.col}` : ""}`;
}
case "logic":
return `${tx("Other")} ${r.key}${r.field ? ` · ${r.field}` : ""}`;
return `${logicNames.get(r.key) ?? tx("Other")}${r.field ? ` · ${r.field}` : ""}`;
case "cost":
return tx(`Base_${r.name}`);
default: