fix(m02-df): 출력 상자별 값은 그 출력 끝수 자리대로 · 검증 칸 글 명사형
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EauA2ATmqNRbeV48s9CcBr
This commit is contained in:
@@ -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}` : ""}`,
|
||||
}),
|
||||
],
|
||||
}),
|
||||
|
||||
@@ -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),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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 }),
|
||||
],
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user