Merge remote-tracking branches 'origin/sub_desktop_1', 'origin/sub_laptop_1' and 'origin/sub_laptop_3' into sub_laptop_4

This commit is contained in:
2026-09-20 16:33:11 +09:00
168 changed files with 8480 additions and 8190 deletions
+14 -13
View File
@@ -4,7 +4,7 @@
* 고친 로직은 저장 전 줄(`row`)을 같이 보내 메모리에서 셈(`POST /calc`) — 파일에 안 씀
* ========================================================================== */
import { createButton, el, showToast } from "@ui/ui_template_elements";
import { createButton, createSelectField, el, showToast } from "@ui/ui_template_elements";
import {
runCalc,
type CalcAnswer,
@@ -15,7 +15,6 @@ import { formatNumber } from "./M01_MasterData_UI_Logic_Edit";
import { tx } from "./M01_MasterData_UI_Logic_Text";
export interface CalcContext {
book: string;
/** 저장된 키 — 새 로직은 null */
savedKey: string | null;
file: string;
@@ -31,22 +30,25 @@ const SUMS = ["노무비", "재료비", "경비", "계"];
export function buildCalc(host: HTMLElement, ctx: CalcContext): void {
const fields = (ctx.row.입력 ?? []).map((spec) => {
const name = spec.이름;
let control: HTMLInputElement | HTMLSelectElement;
let control: HTMLElement;
if (spec.고르기?.length) {
control = el("select", { className: "m01-logic__input" });
for (const option of ["", ...spec.고르기.map(String)]) {
control.append(el("option", { text: option, attrs: { value: option } }));
}
const pick = createSelectField({
options: ["", ...spec.고르기.map(String)].map((o) => ({ value: o, text: o })),
value: ctx.values[name] ?? "",
compact: true,
onChange: (v) => (ctx.values[name] = v),
});
control = pick.root;
} else {
control = el("input", {
const box = el("input", {
className: "m01-logic__input",
attrs: { type: "text", inputmode: "decimal" },
});
if (spec.범위) control.placeholder = `${spec.범위[0]} ∼ ${spec.범위[1]}`;
if (spec.범위) box.placeholder = `${spec.범위[0]} ∼ ${spec.범위[1]}`;
box.value = ctx.values[name] ?? "";
box.addEventListener("input", () => (ctx.values[name] = box.value));
control = box;
}
control.value = ctx.values[name] ?? "";
control.addEventListener("input", () => (ctx.values[name] = control.value));
control.addEventListener("change", () => (ctx.values[name] = control.value));
const label = spec.단위 ? `${name} (${spec.단위})` : name;
return el("label", {
className: "m01-logic__field",
@@ -67,7 +69,6 @@ export function buildCalc(host: HTMLElement, ctx: CalcContext): void {
const draft = ctx.dirty() || ctx.savedKey === null;
try {
const answer = await runCalc({
book: ctx.book,
key: ctx.savedKey ?? ctx.row.키,
inputs,
...(draft ? { row: ctx.row, file: ctx.file } : {}),