From 5bae4c9587fb59c1b109700eedfad1eb1a2b03f4 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Thu, 1 Oct 2026 20:33:35 +0900 Subject: [PATCH] =?UTF-8?q?fix(m02-df):=20=EC=B6=9C=EB=A0=A5=20=EC=83=81?= =?UTF-8?q?=EC=9E=90=EB=B3=84=20=EA=B0=92=EC=9D=80=20=EA=B7=B8=20=EC=B6=9C?= =?UTF-8?q?=EB=A0=A5=20=EB=81=9D=EC=88=98=20=EC=9E=90=EB=A6=AC=EB=8C=80?= =?UTF-8?q?=EB=A1=9C=20=C2=B7=20=EA=B2=80=EC=A6=9D=20=EC=B9=B8=20=EA=B8=80?= =?UTF-8?q?=20=EB=AA=85=EC=82=AC=ED=98=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01EauA2ATmqNRbeV48s9CcBr --- .../DataFlow/M02_DF_OutputPanel.ts | 13 +++++-------- M02_MasterTemplete/DataFlow/M02_DF_Round.ts | 14 ++++++++++++++ M02_MasterTemplete/DataFlow/M02_DF_Summary.ts | 10 ++++++++-- M02_MasterTemplete/DataFlow/M02_DF_Verify.ts | 18 +++++++++--------- 4 files changed, 36 insertions(+), 19 deletions(-) diff --git a/M02_MasterTemplete/DataFlow/M02_DF_OutputPanel.ts b/M02_MasterTemplete/DataFlow/M02_DF_OutputPanel.ts index bef75f6cb..e9c050c5b 100644 --- a/M02_MasterTemplete/DataFlow/M02_DF_OutputPanel.ts +++ b/M02_MasterTemplete/DataFlow/M02_DF_OutputPanel.ts @@ -27,12 +27,12 @@ const TEXT = { From: ["어디서", "From"], Value: ["값", "Value"], NoLink: [ - "아직 이어진 선이 없어요 — 입력이나 함수 상자에서 이 상자로 선을 이어 주세요", + "아직 이어진 선이 없음 — 입력이나 함수 상자에서 이 상자로 선을 이어야 함", "Nothing is linked yet — draw a line from an input or function box", ], Table: ["표", "Table"], - Calc: ["계산 중이 아니에요", "Not calculated"], - Cant: ["지금은 바꿀 수 없어요", "Cannot change this now"], + Calc: ["계산 중이 아님", "Not calculated"], + Cant: ["지금은 바꿀 수 없음", "Cannot change this now"], Round: ["끝수", "Rounding"], RoundPlaces: ["자리", "Places"], RoundMethod: ["방법", "Method"], @@ -43,10 +43,7 @@ const TEXT = { Apply: ["적용", "Apply"], RoundReset: ["기본으로", "Back to default"], RoundUser: ["고른 끝수", "Chosen rounding"], - PlainHint: [ - "원가 합계에 안 넣고 값으로만 보여요", - "Shown as a value, not added to the cost total", - ], + PlainHint: ["원가 합계에 안 넣고 값으로만 보임", "Shown as a value, not added to the cost total"], } as const; type TextKey = keyof typeof TEXT; @@ -128,7 +125,7 @@ export function renderOutputPanel( el("dt", { text: to("Value") }), el("dd", { className: "m02-dfout__num", - text: `${showValue(value, cost !== "값")}${unit && unit !== "-" ? ` ${unit}` : ""}`, + text: `${showValue(value)}${unit && unit !== "-" ? ` ${unit}` : ""}`, }), ], }), diff --git a/M02_MasterTemplete/DataFlow/M02_DF_Round.ts b/M02_MasterTemplete/DataFlow/M02_DF_Round.ts index 3d1a54d90..5341b5a83 100644 --- a/M02_MasterTemplete/DataFlow/M02_DF_Round.ts +++ b/M02_MasterTemplete/DataFlow/M02_DF_Round.ts @@ -88,3 +88,17 @@ export function roundText(r: CfRound): string { const step = r.places > 0 ? Number((10 ** -r.places).toFixed(r.places)) : 1; return `${step}원 미만 ${r.method}`; } + +/** 출력 기본 끝수(표를 읽어 오기 전에는 금액란 0.1원 미만 버림) — 화면이 바로 쓰는 값 */ +let itemNow: CfRound = { places: 1, method: "버림" }; +void defaultItemRound().then((r) => (itemNow = r)); +export const itemRoundNow = (): CfRound => itemNow; + +/** 끝수대로 자른 값을 그 자리 수만큼 보임(3,216.6) — 끝수가 없으면 소수 여섯째 자리까지 */ +export function showRounded(v: number, r?: CfRound): string { + if (!r) return v.toLocaleString("ko-KR", { maximumFractionDigits: 6 }); + return roundBy(r, v).toLocaleString("ko-KR", { + minimumFractionDigits: 0, + maximumFractionDigits: Math.max(0, r.places), + }); +} diff --git a/M02_MasterTemplete/DataFlow/M02_DF_Summary.ts b/M02_MasterTemplete/DataFlow/M02_DF_Summary.ts index 19a2754ac..a4686af39 100644 --- a/M02_MasterTemplete/DataFlow/M02_DF_Summary.ts +++ b/M02_MasterTemplete/DataFlow/M02_DF_Summary.ts @@ -12,7 +12,7 @@ import { formatMoney } from "../../M01_MasterData/M01_MasterData_UI_Logic_Money" import type { CfEvalOptions, CfEvalResult, CfValues } from "./M02_DF_Eval"; import type { CfBox, CfLogic, CfRound } from "./M02_DF_Model"; import { showValue } from "./M02_DF_OutputPanel"; -import { defaultTotalRound, roundBy, roundText } from "./M02_DF_Round"; +import { defaultTotalRound, itemRoundNow, roundBy, roundText, showRounded } from "./M02_DF_Round"; import { renderVerify, type CfSel } from "./M02_DF_Verify"; import "./M02_DF_Summary.css"; @@ -49,6 +49,12 @@ const costText = (c: string): string => (c === "값" ? ts("Plain3") : c); let totalRound: CfRound = { places: 0, method: "버림" }; void defaultTotalRound().then((r) => (totalRound = r)); +/** 출력 상자 값 — 그 출력의 끝수 자리대로(끝수를 안 정했으면 비용은 표준 기본 · 값은 그대로) */ +const shown = (b: CfBox, v: unknown, isCost: boolean): string => + typeof v === "number" + ? showRounded(v, b.output?.round ?? (isCost ? itemRoundNow() : undefined)) + : showValue(v as never); + /** 원가 합계 칸 — result = 화면 계산 결과 · on 이 있으면 예시값을 바꿀 수 있음 · opts.values = 받은 입력 값(검사가 씀) */ export function renderSummary( host: HTMLElement, @@ -89,7 +95,7 @@ export function renderSummary( ...(isCost ? [el("td", { text: costText(b.output?.cost ?? "") })] : []), el("td", { className: "m02-dfsum__num", - text: showValue(result.outputs[b.id], isCost), + text: shown(b, result.outputs[b.id], isCost), }), el("td", { text: b.output?.unit ?? b.unit }), ], diff --git a/M02_MasterTemplete/DataFlow/M02_DF_Verify.ts b/M02_MasterTemplete/DataFlow/M02_DF_Verify.ts index c02658d53..9c1e422bd 100644 --- a/M02_MasterTemplete/DataFlow/M02_DF_Verify.ts +++ b/M02_MasterTemplete/DataFlow/M02_DF_Verify.ts @@ -23,9 +23,9 @@ import "./M02_DF_Verify.css"; const TEXT = { Breaks: ["끊긴 곳", "Broken spots"], - BreaksHint: ["누르면 그 상자 · 선을 골라요", "Click to select the box or line"], + BreaksHint: ["누르면 그 상자 · 선을 고름", "Click to select the box or line"], Design: ["설계 때 정할 것", "To decide at design time"], - DesignHint: ["여기서 바꾸면 해당 상자도 바뀌어요", "Changing here changes the box too"], + DesignHint: ["여기서 바꾸면 그 상자도 바뀜", "Changing here changes the box too"], Vars: ["변수 예시값", "Variable samples"], Slots: ["재료 선택 자리", "Material choice"], Rules: ["재료 조건 자리", "Material by condition"], @@ -37,23 +37,23 @@ const TEXT = { Next: ["다음", "Next"], Search: ["재료 이름 · 규격", "Material name or size"], Page: ["쪽 {p} / {n} · 모두 {t}", "Page {p} / {n} · {t} in all"], - NoHit: ["찾은 재료가 없어요", "No material found"], - NoDefault: ["아직 고르지 않았어요", "Nothing chosen yet"], + NoHit: ["찾은 재료 없음", "No material found"], + NoDefault: ["아직 고르지 않음", "Nothing chosen yet"], Price: ["단가", "Unit price"], Won: ["원", "KRW"], Loading: ["찾는 중", "Searching"], - NeedValue: ["조건 값이 아직 없어요", "The condition value is not there yet"], + NeedValue: ["조건 값이 아직 없음", "The condition value is not there yet"], Caught: ["잡힌 품목", "Matched item"], Zero: ["맞는 재료 없음(0)", "No matching material (0)"], Many: ["여럿 맞음({n}) — 첫째를 씀", "{n} match — the first is used"], Cond: ["{field}에 「{v}」 {op}", "{field} {op} “{v}”"], - Pick: ["고르세요", "Choose"], - Bad: ["숫자를 넣어 주세요", "Enter a number"], + Pick: ["선택", "Choose"], + Bad: ["숫자를 넣어야 함", "Enter a number"], Range: ["{a} ∼ {b} 사이", "between {a} and {b}"], - Cant: ["지금은 바꿀 수 없어요", "Cannot change this now"], + Cant: ["지금은 바꿀 수 없음", "Cannot change this now"], OwnSample: ["비우면 그 로직 예시값", "Empty = the logic's own sample"], OtherLogic: [ - "이어 주지 않아서 그 로직의 예시값을 써요", + "이어 주지 않아 그 로직의 예시값을 씀", "Not linked — the logic's own sample is used", ], } as const;