refactor(856-4): 거꾸로 부름 끊기 본문 — 앞 커밋(bd41d8799)은 이름 옮김만 담김 · 이 커밋과 한 묶음

- 앞 커밋 글 그대로(층 · 부름 common_util_m02_call · 찾아 넣기 창 StackFind 주입 · 단위 고르기 부품 상자 · 합계 상자 A00 · 기계 칸 부품)
- 앞 커밋에서 git add 가 옛 경로에 걸려 고친 파일이 빠짐 — 두 커밋을 같이 올림

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 21:02:55 +09:00
co-authored by Claude Opus 5.5
parent bd41d87996
commit a8d6b426d0
34 changed files with 330 additions and 235 deletions
+64
View File
@@ -0,0 +1,64 @@
/* formula_doc_foot.css — 수식 화면 맨 아래 합계 상자(PLAN 737-1 · 803-2a · 856-4 — M01 LogicLab_Style 에서 옮김) */
.m01lab__total {
margin: var(--spacing-8) 0 0;
font-weight: 700;
text-align: right;
}
/* 737-1 맨 아래 한 줄 4 칸(노무비 · 재료비 · 경비 · 계) — 화면(모달) 바닥에 붙음 · 칸마다 이름 위 · 값 아래 */
.m01lab__foot {
position: sticky;
bottom: 0;
z-index: 2;
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: var(--spacing-8);
margin-top: var(--m01lab-box-gap, var(--spacing-12));
padding: var(--spacing-8) var(--spacing-12);
border: 1px solid var(--color-border);
border-radius: var(--radius-lg);
background: var(--color-surface-raised);
}
/* 합계 줄이 화면 바닥에 붙으려면 메인 칸이 굴림 칸(overflow:auto)이 아니어야 함 — 메인은 높이가 안 묶여 안 굴렀음 */
.ui-workflow-layout__main:has(.m01lab__foot) {
overflow: clip;
}
.m01lab__sums {
display: contents;
}
.m01lab__foot .ui-calc-row {
display: flex;
flex-direction: column;
align-items: stretch;
gap: 0;
min-height: 0;
}
.m01lab__foot .ui-calc-row > :empty {
display: none;
}
.m01lab__foot .ui-calc-row__out {
padding: 0;
text-align: left;
}
.m01lab__foot .m01lab__total {
display: flex;
flex-direction: column;
margin: 0;
text-align: left;
}
.m01lab__foot .m01lab__total > :first-child {
color: var(--color-text-secondary);
font-weight: var(--font-weight-regular, 400);
}
.m01lab__foot .m01lab__total > :last-child {
font-variant-numeric: tabular-nums;
}
+38 -9
View File
@@ -1,20 +1,49 @@
/* =============================================================================
* formula_doc_foot.ts
* 수식 탭 맨 아래 합계 상자(PLAN 803-2a · 요구 667-2) — 단가산출 상세 탭과 같은 부품(`buildFoot` · 노무비 · 재료비 · 경비 · 계)
* 값 = 계산기 셈 그대로(여기서 다시 셈 안 함) · 셈 못 함 = 「—」
* 수식 탭 맨 아래 합계 상자(PLAN 803-2a · 요구 667-2 · 737-1) — 노무비 · 재료비 · 경비 · 계 네 칸 · 화면(모달) 바닥에 붙음
* 값 = 계산기 셈 그대로(여기서 다시 셈 안 함) · 셈 못 함 = 「—」 · 856-4 = M01 `LogicLab_Foot` 을 여기로(쓰는 곳 하나)
* ========================================================================== */
import { createCalcFormulaRow } from "@ui/ui_template_calc_row";
import { el } from "@ui/ui_template_elements";
import { formatMoney } from "../common_util/common_util_money";
import type { DocAnswer } from "../common_util/common_util_formula_doc_calc";
import { buildFoot } from "../M01_MasterData/M01_MasterData_UI_LogicLab_Foot";
import "../M01_MasterData/M01_MasterData_UI_LogicLab_Style.css";
import { ft } from "./formula_doc_text";
import "./formula_doc_foot.css";
const num = (v: unknown): number => (typeof v === "number" && Number.isFinite(v) ? v : 0);
const PARTS = [
["labor", "노무비"],
["material", "재료비"],
["cost", "경비"],
] as const;
export function docFoot(a: DocAnswer): HTMLElement {
const done = !!a.셈됨 && typeof a.계 === "number";
return buildFoot(
{ labor: num(a.노무비), material: num(a.재료비), cost: num(a.경비) },
done,
num(a.계),
);
const sums = { labor: num(a.노무비), material: num(a.재료비), cost: num(a.경비) };
const total = num(a.계);
const cells = PARTS.map(([k, label]) => {
const out = el("span", {
className: "ui-calc-row__out is-key",
text: done ? formatMoney(sums[k]) : "—",
});
const row = createCalcFormulaRow(label, null, out);
row.dataset.group = k;
row.dataset.subtotal = done ? String(sums[k]) : "";
return row;
});
return el("div", {
className: "m01lab__foot",
children: [
el("div", { className: "m01lab__sums", children: cells }),
el("p", {
className: "m01lab__total",
attrs: { "data-sum": done ? String(total) : "" },
children: [
el("span", { text: `${ft("Sum")} ` }),
el("span", { text: done ? formatMoney(total) : "—" }),
],
}),
],
});
}
+6 -3
View File
@@ -56,7 +56,7 @@ import {
unswap,
} from "../common_util/common_util_line_stack_pick";
import { shownUnitOf, type TableLook } from "../common_util/common_util_line_stack_unit";
import { createUnitPick, NO_UNIT } from "../M02_MasterTemplete/DataFlow/M02_DF_UnitPick";
import { createUnitPick, NO_UNIT } from "@ui/ui_template_unit_pick";
import { hiddenByWork, reach } from "./formula_doc_render";
import { attachDrag } from "./line_stack_drag";
import type { WorkSpec } from "../common_util/common_util_formula_doc_work";
@@ -64,7 +64,7 @@ import { openMachineWindow, type MachineCtx } from "./line_stack_machine";
import { dropCover } from "../common_util/common_util_formula_doc_cover_drop";
import { buildMachineCtl, lineCall } from "./line_stack_machine_ctl";
import { putWork, swapMachine } from "./line_stack_machine_work";
import { openStackPick, type StackTake } from "./line_stack_pick";
import { openStackPick, type StackFind, type StackTake } from "./line_stack_pick";
import { buildBlock, sourceTag } from "./line_stack_rows";
import { lt, type LsKey } from "./line_stack_text";
@@ -99,6 +99,8 @@ export interface EditHooks {
upper?: Cover | null;
/** 848-3 M01 기초 제어 구역 엶(시스템 관리자) — M02 = 층(`machine.scope`)이 엶 */
ctlEdit?: boolean;
/** 856-4 찾아 넣기 창(페이지가 넘김) */
find: StackFind;
}
const field = (
@@ -229,7 +231,7 @@ function moneyBody(h: EditHooks, i: number): HTMLElement[] {
query,
pick: fixed ? swapFixed : swap,
})
: openStackPick(kind, swap, undefined, query),
: openStackPick(h.find, kind, swap, undefined, query),
});
pick.classList.add("lstk-res");
pick.title = `${lt("Repick")}${res ? ` — ${res}` : ""}`;
@@ -406,6 +408,7 @@ function readQty(text: string, note: string, tag: string): HTMLElement {
function addLine(h: EditHooks, at: number, kind: string): void {
if (["인력", "재료", "기계", "단가산출"].includes(kind))
return openStackPick(
h.find,
kind as MoneyKind,
(p) => h.change((d, items) => void addPicked(d, items[at], kind as MoneyKind, p)),
h.take,
+1 -1
View File
@@ -14,7 +14,7 @@ import { openModal } from "@ui/ui_template_modal";
import { createText } from "@ui/ui_template_text";
import { isDraftNo, type DraftItem } from "../common_util/common_util_line_stack_draft";
import type { Picked } from "../common_util/common_util_line_stack_pick";
import { call, type Layer } from "../M02_MasterTemplete/M02_MasterTemplete_Api_Fetch";
import { call, type Layer } from "../common_util/common_util_m02_call";
import {
listMyMachines,
machineArg,
+66
View File
@@ -0,0 +1,66 @@
/* =============================================================================
* line_stack_machine_cell.ts
* 기계 제어 구역 칸 부품(PLAN 856-4) — 수 칸 · 「바뀜」 표시(출처 테두리 · 원래 값 풍선)
* 제어 구역(`line_stack_machine_ctl`) · 작업량 묶음(`line_stack_machine_work`)이 같이 씀 — 둘이 서로 부르던 고리 끊음
* ========================================================================== */
import { setUiDiff, type UiDiff } from "@ui/ui_template_button";
import { el, showToast } from "@ui/ui_template_elements";
import { createInputField } from "@ui/ui_template_input";
import { MINE, type Source } from "../common_util/common_util_formula_doc_cover";
import { lt } from "./line_stack_text";
/** 출처(848-3) — 나 · 위 층. 테두리는 나만(892) · 풍선(원래 값)은 둘 다 */
export type DiffSrc = UiDiff | "upper";
export const diffOf = (src: Source | undefined): DiffSrc | null =>
src === undefined ? null : src === MINE ? "mine" : "upper";
/** 칸 묶음 안 입력 · 고르기 · 이름 단추에 「바뀜」 상태(나만) · 풍선(원래 값) */
export function markDiff(box: HTMLElement, diff: DiffSrc | null, was?: string): void {
const own = ["ui-input", "ui-select", "ui-btn"].some((c) => box.classList.contains(c));
const nodes = own ? [box] : ["ui-input", "ui-select", "lstk-res"].flatMap((c) => [...box.querySelectorAll<HTMLElement>(`.${c}`)]); // prettier-ignore
for (const n of nodes) {
setUiDiff(n, diff === "mine" ? "mine" : null);
if (diff && was !== undefined)
n.title = `${n.title ? `${n.title} — ` : ""}${lt("Ctl_Was")} ${was}`;
}
}
const num = (t: string): number | null => {
const n = Number(t.trim().replace(/,/g, ""));
return t.trim() !== "" && Number.isFinite(n) ? n : null;
};
/** 수 칸 — 빈 글 = 원래대로(null) · 음수 · 글 = 알림 · 단위 = 칸 바로 뒤(공식 묶음 값 칸과 같은 자리 · 845-2 ㉥) */
export function numBox(
label: string,
value: unknown,
unit: string,
ro: boolean,
set: (n: number | null) => void,
hint = "",
): HTMLElement {
const f = createInputField({
value: value === undefined || value === null ? "" : String(value),
placeholder: hint,
compact: true,
size: 24,
});
f.root.classList.add("lstk-f-s");
f.input.setAttribute("aria-label", label);
f.input.title = label;
f.input.disabled = ro;
f.input.addEventListener("change", () => {
const t = f.input.value;
const n = num(t);
if (t.trim() === "") return set(null);
if (n === null || n < 0) {
f.input.value = value === undefined || value === null ? "" : String(value);
return void showToast(lt("Ctl_Bad"), "warning");
}
set(n);
});
return unit
? el("span", { className: "lstk-qty", children: [f.root, el("span", { className: "lstk-unit", text: unit })] }) // prettier-ignore
: f.root;
}
+12 -65
View File
@@ -16,10 +16,10 @@
* 「고침」 글 배지 없음(테두리로) · 칸 풍선 = 원래 값 · M01 기초(시스템 관리자) = ① 없음 → 기초 고침 = 「나」
* ========================================================================== */
import { createButton, createIconButton, setUiDiff, type UiDiff } from "@ui/ui_template_button";
import { createButton, createIconButton } from "@ui/ui_template_button";
import { eqText } from "@ui/ui_template_equation";
import { el, showToast } from "@ui/ui_template_elements";
import { createInputField, createSelectField } from "@ui/ui_template_input";
import { el } from "@ui/ui_template_elements";
import { createSelectField } from "@ui/ui_template_input";
import { varId, type FormulaDoc, type Link } from "../common_util/common_util_formula_doc";
import { WORK, workKey, type WorkCover } from "../common_util/common_util_formula_doc_work";
import type { DocAnswer } from "../common_util/common_util_formula_doc_calc";
@@ -28,7 +28,6 @@ import {
defaultsOf,
layeredCover,
machineKey,
MINE,
partsOf,
putCover,
rowEntry,
@@ -38,7 +37,6 @@ import {
type CrewRow,
type CoverEntry,
type MiscRow,
type Source,
} from "../common_util/common_util_formula_doc_cover";
import { subInputs, type StackDoc } from "../common_util/common_util_line_stack";
import type { Picked } from "../common_util/common_util_line_stack_pick";
@@ -46,9 +44,9 @@ import { machineUnit } from "../common_util/common_util_line_stack_unit";
import { attachHost, workAt, workOfMachine } from "../common_util/common_util_line_stack_work";
import { sites, type WorkSpec } from "../common_util/common_util_formula_doc_work";
import { machineCellName } from "../common_util/common_util_machine_symbol_name";
import { openFindPicker } from "../M02_MasterTemplete/M02_MasterTemplete_Find_Pick";
import { buildWorkGroup, putWork } from "./line_stack_machine_work";
import { openStackPick } from "./line_stack_pick";
import { openStackPick, type StackFind } from "./line_stack_pick";
import { diffOf, markDiff, numBox } from "./line_stack_machine_cell";
import { lt } from "./line_stack_text";
export interface CtlHooks {
@@ -69,22 +67,8 @@ export interface CtlHooks {
work?: (machine: string) => WorkSpec[];
/** 848-3 ① 위 층 고침(SK 읽기 답 `위덮음` · M01 = 없음) */
upper?: Cover | null;
}
/** 출처(848-3) — 나 · 위 층. 테두리는 나만(892) · 풍선(원래 값)은 둘 다 */
export type DiffSrc = UiDiff | "upper";
export const diffOf = (src: Source | undefined): DiffSrc | null =>
src === undefined ? null : src === MINE ? "mine" : "upper";
/** 칸 묶음 안 입력 · 고르기 · 이름 단추에 「바뀜」 상태(나만) · 풍선(원래 값) */
export function markDiff(box: HTMLElement, diff: DiffSrc | null, was?: string): void {
const own = ["ui-input", "ui-select", "ui-btn"].some((c) => box.classList.contains(c));
const nodes = own ? [box] : ["ui-input", "ui-select", "lstk-res"].flatMap((c) => [...box.querySelectorAll<HTMLElement>(`.${c}`)]); // prettier-ignore
for (const n of nodes) {
setUiDiff(n, diff === "mine" ? "mine" : null);
if (diff && was !== undefined)
n.title = `${n.title ? `${n.title} — ` : ""}${lt("Ctl_Was")} ${was}`;
}
/** 856-4 찾아 넣기 창(페이지가 넘김) */
find: StackFind;
}
const FUELS = ["경유", "휘발유", "실내등유"];
@@ -120,45 +104,6 @@ export function ctlOf(h: CtlHooks, link: Link | undefined, at?: number) {
return { machine, sub, vals, base, up, top: upperOf(base, up), entry: coverOf(h.doc)[machine] };
}
const num = (t: string): number | null => {
const n = Number(t.trim().replace(/,/g, ""));
return t.trim() !== "" && Number.isFinite(n) ? n : null;
};
/** 수 칸 — 빈 글 = 원래대로(null) · 음수 · 글 = 알림 · 단위 = 칸 바로 뒤(공식 묶음 값 칸과 같은 자리 · 845-2 ㉥) */
export function numBox(
label: string,
value: unknown,
unit: string,
ro: boolean,
set: (n: number | null) => void,
hint = "",
): HTMLElement {
const f = createInputField({
value: value === undefined || value === null ? "" : String(value),
placeholder: hint,
compact: true,
size: 24,
});
f.root.classList.add("lstk-f-s");
f.input.setAttribute("aria-label", label);
f.input.title = label;
f.input.disabled = ro;
f.input.addEventListener("change", () => {
const t = f.input.value;
const n = num(t);
if (t.trim() === "") return set(null);
if (n === null || n < 0) {
f.input.value = value === undefined || value === null ? "" : String(value);
return void showToast(lt("Ctl_Bad"), "warning");
}
set(n);
});
return unit
? el("span", { className: "lstk-qty", children: [f.root, el("span", { className: "lstk-unit", text: unit })] }) // prettier-ignore
: f.root;
}
const kind = (text: string): HTMLElement => el("span", { className: "lstk-kind", text });
/** 기계 제어 구역 — `link` = 그 기계 줄 단가 기호 연결 · `at` = 그 금액 줄 차례(작업량) */
@@ -243,7 +188,7 @@ export function buildMachineCtl(
lt("K_인력"),
crewName(r, i),
ro,
() => openStackPick("인력", (p) => setCrew(swapAt(crew, i, { ...r, 키: p.키, 이름: p.이름 })), undefined, crewName(r, i)), // prettier-ignore
() => openStackPick(h.find, "인력", (p) => setCrew(swapAt(crew, i, { ...r, 키: p.키, 이름: p.이름 })), undefined, crewName(r, i)), // prettier-ignore
[numBox(lt("Ctl_Crew_Qty"), r.인, lt("Ctl_Per_Day"), ro, (n) => setCrew(swapAt(crew, i, { ...r, 인: n ?? 0 })))], // prettier-ignore
"노무비",
() => setCrew(crew.filter((_, k) => k !== i)),
@@ -265,7 +210,7 @@ export function buildMachineCtl(
return [r.줄, fuel].filter(Boolean).join(" · ");
};
const pickMat = (done: (p: Picked) => void, query: string): void =>
openFindPicker({
h.find({
layer: "system",
owner: null,
title: `${lt("Find_Title")} — ${lt("Ctl_Misc")}`,
@@ -363,7 +308,9 @@ export function buildMachineCtl(
lt("Ctl_Crew"),
entry.조종원 !== undefined,
() =>
openStackPick("인력", (p) => setCrew([...crew, { 키: p.키, 이름: p.이름, 인: 1 }])),
openStackPick(h.find, "인력", (p) =>
setCrew([...crew, { 키: p.키, 이름: p.이름, 인: 1 }]),
),
() => put({ ...entry, 조종원: undefined }),
ro,
),
+4
View File
@@ -69,6 +69,7 @@ import { sheetWorkCard, sheetWorkOut, type SheetWorkOpts } from "./line_stack_ma
import { buildOut } from "./line_stack_out";
import "./line_stack.css";
import "./line_stack_machine_sheet.css";
import type { StackFind } from "./line_stack_pick";
export interface MachineSimilar {
key: string;
@@ -91,6 +92,8 @@ export interface MachineSheetOptions {
findSimilar?: (q: string) => Promise<MachineSimilar[]>;
onSimilar?: (item: MachineSimilar) => void;
onChange?: () => void;
/** 856-4 찾아 넣기 창(조종원 · 잡품 고르기 — 페이지가 넘김) */
find: StackFind;
}
export interface MachineSheetState {
@@ -287,6 +290,7 @@ export function createMachineSheet(o: MachineSheetOptions) {
readOnly: ro,
lists: () => engineVals(orig, mine),
lock,
find: o.find,
},
{ ...link, 키: info.키 },
);
+1 -1
View File
@@ -47,7 +47,7 @@ import type { Picked } from "../common_util/common_util_line_stack_pick";
import type { Values } from "../common_util/common_util_formula_doc_view";
import { varUnit } from "../common_util/common_util_line_stack_unit";
import { workUnit } from "../common_util/common_util_line_stack_work";
import { diffOf, markDiff, numBox, type DiffSrc } from "./line_stack_machine_ctl";
import { diffOf, markDiff, numBox, type DiffSrc } from "./line_stack_machine_cell";
import { lt } from "./line_stack_text";
import { workRows } from "./line_stack_work";
+1 -1
View File
@@ -12,7 +12,7 @@ import { showToast } from "@ui/ui_template_elements";
import { askConfirm } from "@ui/ui_template_modal";
import type { FormulaDoc } from "../common_util/common_util_formula_doc";
import type { Picked } from "../common_util/common_util_line_stack_pick";
import { call, type Layer } from "../M02_MasterTemplete/M02_MasterTemplete_Api_Fetch";
import { call, type Layer } from "../common_util/common_util_m02_call";
import { at } from "../M02_MasterTemplete/M02_MasterTemplete_Hopyo_Api";
import { placeNote } from "../M01_MasterData/M01_MasterData_Api_Fetch";
import type { MachineCtx } from "./line_stack_machine";
+41 -5
View File
@@ -1,7 +1,8 @@
/* =============================================================================
* line_stack_pick.ts
* 줄 쌓기 고르기 창(PLAN 804-3 · 804-4 · 요구 678-1 · 678-3 · 680-1 · 681)
* 찾아 넣기 = M02 [항목 추가] 창 그대로(`openFindPicker` · 탭 M01 전체 · 찾기 칸 · 표) — 줄 갈래마다 그 종류만
* 찾아 넣기 = M02 [항목 추가] 창 그대로(`openFindPicker` · 탭 M01 전체 · 찾기 칸 · 표) — 줄 갈래마다 그 종류만 ·
* 창은 페이지가 넘김(`StackFind` · 856-4 — 공용 화면은 M02 를 부르지 않음)
* 인력(노임 LB) · 재료(자재 MT) · 기계(EQ → 시간당 경비 로직 + 기계='원문번호') · 다른 단가산출(M01 단가산출 로직)
* 기계 + M02 개인 층(821-3) = 품셈 기계 위 「내 기계」 묶음 · 머리 [새 기계 만들기] — 고름 = 로직 + 기계='개인 EQP…'
* 재료 + M02 개인 층(840-4) = M01 재료 위 「내 재료」 묶음 — 고름 = 요소 PM 키(M01 재료와 같은 꼴)
@@ -22,11 +23,45 @@ import type { DocTable } from "../common_util/common_util_formula_doc_table";
import type { MoneyKind } from "../common_util/common_util_line_stack";
import type { Picked } from "../common_util/common_util_line_stack_pick";
import { showToast } from "@ui/ui_template_elements";
import type { Layer } from "../M02_MasterTemplete/M02_MasterTemplete_Api_Fetch";
import { openFindPicker, type FindKind } from "../M02_MasterTemplete/M02_MasterTemplete_Find_Pick";
import type { Layer } from "../common_util/common_util_m02_call";
import { lt } from "./line_stack_text";
const KINDS: Partial<Record<MoneyKind, FindKind>> = {
/** 찾아 넣기 종류 — logic = M01 단가산출 · 기초 · labor = 인력 · material = 재료 · machine = 기계 · oil = 유가 · sk = M02 단가산출 · pre = 일위대가 */
export type StackFindKind = "logic" | "labor" | "material" | "machine" | "oil" | "sk" | "pre";
/** 고른 M01 요소 중 공용 화면이 읽는 칸 */
interface FoundElement {
코드: string;
이름: string;
규격: string;
단위: string;
/** 기계(804-3) — 시간당 경비 로직 키 · 기종 원문번호 */
로직?: string;
원문번호?: string;
}
/** 찾아 넣기 창 옵션 — 공용 화면이 쓰는 칸만(M02 `FindPickOptions` 와 같은 뜻) */
export interface StackFindOptions {
layer: Layer;
owner: string | null;
title?: string;
kinds?: StackFindKind[];
query?: string;
/** 돈 아닌 기초(작업량 등 결과)만 */
results?: boolean;
logic: (x: { 키: string; 이름: string; 결과단위: string }) => void;
ref?: (r: { 층: string; 주인: string | null; 키: string }) => void;
element?: (e: FoundElement) => void;
machine?: (e: FoundElement) => void;
oil?: (e: FoundElement) => void;
mine?: { owner: string | null };
mineMat?: { owner: string | null };
}
/** 찾아 넣기 창(856-4) — 페이지가 넘김(M01 · M02 = M02 `openFindPicker`) */
export type StackFind = (o: StackFindOptions) => void;
const KINDS: Partial<Record<MoneyKind, StackFindKind>> = {
인력: "labor",
재료: "material",
기계: "machine",
@@ -44,6 +79,7 @@ export interface StackTake {
/** 찾아 넣기 — 고르면 `done(고른 것)` · 닫으면 아무것도 안 함 · `m02` 있고 다른 단가산출 = 복사해 펼침 ·
* `query` = 찾기 칸에 넣고 연 결과(이름 단추 · 요구 687-9) */
export function openStackPick(
find: StackFind,
kind: MoneyKind,
done: (p: Picked) => void,
m02?: StackTake,
@@ -53,7 +89,7 @@ export function openStackPick(
if (!want) return;
const spec = (e: { 규격: string }) => (e.규격 ? { 규격: e.규격 } : {});
const copy = kind === "단가산출" && m02 ? m02 : null;
openFindPicker({
find({
layer: copy?.layer ?? "system",
owner: copy?.owner ?? null,
title: `${lt("Find_Title")} — ${lt(copy ? "K_복사" : (`K_${kind}` as never))}`,
+1 -2
View File
@@ -45,7 +45,6 @@ import {
tableAlias,
} from "../common_util/common_util_line_stack_pick";
import { shownUnitOf, unitText } from "../common_util/common_util_line_stack_unit";
import { openFindPicker } from "../M02_MasterTemplete/M02_MasterTemplete_Find_Pick";
import type { EditHooks } from "./line_stack_edit";
import { openTablePick } from "./line_stack_pick";
import { lt } from "./line_stack_text";
@@ -282,7 +281,7 @@ export function buildBlock(
variant: "ghost",
size: 24,
onClick: () =>
openFindPicker({
h.find({
layer: "system",
owner: null,
title: lt("K_단가산출"),
+5 -1
View File
@@ -70,7 +70,7 @@ import { hiddenByWork } from "./formula_doc_render";
import { ft } from "./formula_doc_text";
import { addTaken, type Taken } from "../common_util/common_util_line_stack_copy";
import { machineWork } from "../common_util/common_util_line_stack_work";
import type { Layer } from "../M02_MasterTemplete/M02_MasterTemplete_Api_Fetch";
import type { Layer } from "../common_util/common_util_m02_call";
import { applyDiff } from "./line_stack_diff";
import { buildEdit } from "./line_stack_edit";
import { openMachineWindow, type CopyAnswer, type MachineCtx } from "./line_stack_machine";
@@ -78,6 +78,7 @@ import { dropPath } from "../common_util/common_util_formula_doc_cover_drop";
import { buildOut } from "./line_stack_out";
import { lt } from "./line_stack_text";
import "./line_stack.css";
import type { StackFind } from "./line_stack_pick";
export interface StackScreenOptions {
/** 길 앞머리(`/m01/logic/doc`) — GET ?key · POST /preview · /save · /links */
@@ -94,6 +95,8 @@ export interface StackScreenOptions {
tools?: HTMLElement;
/** 저장 전 SK 문서(836-5 · 불러오기 미리 보기) — 빈 키일 때 이 문서를 서버가 읽어 줌(파일 안 읽음 · 안 씀) */
memory?: () => Record<string, unknown> | null;
/** 856-4 찾아 넣기 창(M01 · M02 = M02 `openFindPicker`) — 공용 화면은 M02 를 부르지 않음 */
find: StackFind;
}
type Docs = Record<string, FormulaDoc>;
@@ -408,6 +411,7 @@ export function createStackScreen(opt: StackScreenOptions) {
...(edit() || mem()
? [
buildEdit({
find: opt.find,
doc,
answer,
items,
@@ -47,6 +47,7 @@ import { buildHeadBar } from "./M01_MasterData_UI_Head";
import { fetchSessionUser } from "../A06_Login/A06_Login_Api_Fetch";
import "./M01_MasterData_UI_Logic_Style.css";
import { createEmpty } from "@ui/ui_template_empty";
import { openFindPicker } from "../M02_MasterTemplete/M02_MasterTemplete_Find_Pick";
/** 저장 안 한 로직 하나 — origKey null = 새 로직 · row null = 지움 */
interface Draft {
@@ -99,6 +100,7 @@ export async function mountM01LogicLab(
.catch(() => false);
// 수식 = 줄 쌓기(804-2 · 804-6 옛 수식 문서 탭 걷음) — 수식 문서 · 캐시 m01_doc_drafts
const stack = createStackScreen({
find: openFindPicker, // 856-4 찾아 넣기 창(M02 창 · M01 전체 탭만)
base: "/m01/logic/doc",
admin,
cache: "m01_doc_drafts",
@@ -56,12 +56,6 @@
white-space: pre-wrap;
}
.m01lab__total {
margin: var(--spacing-8) 0 0;
font-weight: 700;
text-align: right;
}
.m01lab__modal {
overflow: auto;
}
@@ -148,69 +142,7 @@
overflow: auto;
}
/* 737-1 맨 아래 한 줄 4 칸(노무비 · 재료비 · 경비 · 계) — 화면(모달) 바닥에 붙음 · 칸마다 이름 위 · 값 아래 */
.m01lab__foot {
position: sticky;
bottom: 0;
z-index: 2;
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: var(--spacing-8);
margin-top: var(--m01lab-box-gap, var(--spacing-12));
padding: var(--spacing-8) var(--spacing-12);
border: 1px solid var(--color-border);
border-radius: var(--radius-lg);
background: var(--color-surface-raised);
}
/* 합계 줄이 화면 바닥에 붙으려면 메인 칸이 굴림 칸(overflow:auto)이 아니어야 함 — 메인은 높이가 안 묶여 안 굴렀음 */
.ui-workflow-layout__main:has(.m01lab__foot) {
overflow: clip;
}
.m01lab__sums {
display: contents;
}
/* 748-3 텍스트 수식 바닥 줄 = 세 칸(계 칸 없음) */
.m01lab__foot[data-cols="3"] {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
/* 748-3 비목 상자 사이 간격 = 바닥 고정 줄 위 여유(같은 값 · 두 보기) */
.m01-logic__editor {
--m01lab-box-gap: var(--spacing-12);
}
.m01lab__foot .ui-calc-row {
display: flex;
flex-direction: column;
align-items: stretch;
gap: 0;
min-height: 0;
}
.m01lab__foot .ui-calc-row > :empty {
display: none;
}
.m01lab__foot .ui-calc-row__out {
padding: 0;
text-align: left;
}
.m01lab__foot .m01lab__total {
display: flex;
flex-direction: column;
margin: 0;
text-align: left;
}
.m01lab__foot .m01lab__total > :first-child {
color: var(--color-text-secondary);
font-weight: var(--font-weight-regular, 400);
}
.m01lab__foot .m01lab__total > :last-child {
font-variant-numeric: tabular-nums;
}
@@ -22,7 +22,6 @@ const TEXT = {
],
View_Equation: ["수식", "Equation"],
Subtotal: ["소계", "Subtotal"],
Total: ["계", "Total"],
Extra: ["덧줄", "Extra"],
Col_Name: ["이름", "Name"],
Col_Unit: ["단위", "Unit"],
@@ -32,6 +32,7 @@ import {
type MachineUses,
} from "./M01_MasterData_Machine_Api";
import type { Pick } from "./M01_MasterData_UI_Side";
import { openFindPicker } from "../M02_MasterTemplete/M02_MasterTemplete_Find_Pick";
export interface MachineDetailOptions {
target: string;
@@ -105,6 +106,7 @@ async function build(host: HTMLElement, opts: MachineDetailOptions, alive: () =>
const notice = el("div");
const form = createMachineSheet({
find: openFindPicker, // 856-4
orig: (orig ?? cur) as Row,
cur,
mine: false,
@@ -15,6 +15,7 @@ import { currentLanguageIndex } from "@ui/ui_template_locale";
import { createText } from "@ui/ui_template_text";
import { createStackScreen } from "../A00_Common/line_stack_screen";
import type { Pick } from "./M01_MasterData_UI_Side";
import { openFindPicker } from "../M02_MasterTemplete/M02_MasterTemplete_Find_Pick";
interface Part {
키: string;
@@ -47,6 +48,7 @@ export function renderParts(host: HTMLElement, pick: Pick, openLogic: (key: stri
/** 줄 쌓기 읽기 창 — 고침 없음 · [단가산출 기초에서 열기] = 수식 탭에서 고침 */
const show = (p: Part): void => {
partsStack ??= createStackScreen({
find: openFindPicker, // 856-4
base: "/m01/logic/doc",
admin: false,
cache: "m01_parts_view",
+2 -14
View File
@@ -1,23 +1,11 @@
/* =============================================================================
* M02_DF_Api.ts
* 단위 표준 표 읽기 — 서버 `GET /api/m02/df/standards`(`M02_DF_Router.py`)
* 부르는 곳 = 단위 고르기(`M02_DF_UnitPick`) · 옵션 기계 이름(`formula_doc_options`)
* 기계 이름 · 끈 기계 읽기 — 서버 `GET /api/m02/df/machine-names` · `machine-off`(`M02_DF_Router.py`)
* 부르는 곳 = 옵션 기계 이름(`formula_doc_options`) · 단위 표준 표 읽기는 단위 고르기(`ui_template_unit_pick`)로 옮김(856-4)
* ========================================================================== */
import { API_BASE_URL } from "@config/config_frontend";
/** 단위 표준 표 */
export interface CfStandards {
unit: { 이름: string; 줄: Record<string, unknown>[]; [k: string]: unknown };
saved: boolean;
}
export async function cfStandards(): Promise<CfStandards> {
const response = await fetch(`${API_BASE_URL}/m02/df/standards`, { credentials: "include" });
if (!response.ok) throw new Error(`표준 표 읽기 실패 (${response.status})`);
return (await response.json()) as CfStandards;
}
let machineNames: Promise<Record<string, string>> | null = null;
/** 기계 원문번호 → 「이름 규격」 — 한 번 받아 둠(못 받으면 빈 표 · 다음에 다시) */
@@ -3,10 +3,10 @@
* 마스터 템플릿 서버 호출 — 계약 `6_계약.md` 서버 길 · 시스템 층은 시스템 관리자만
* ========================================================================== */
import { API_BASE_URL } from "@config/config_frontend";
import { call, type Layer } from "../common_util/common_util_m02_call";
/** 층 이름 — 서버와 같은 글 */
export type Layer = "system" | "company" | "personal" | "project";
// 층 이름 · `/api/m02` 부름 = 공용 조각(856-4 — 줄 쌓기 공용 화면도 씀) · 여기서 그대로 내보냄
export { call, StaleError, type Layer } from "../common_util/common_util_m02_call";
/** 서버 종류 — 화면의 「표 양식」 = table · 「도면 양식」 = drawing · 「구조물 도면」 = structure ·
* 「면적산출」 = area(구조물집계표 열마다 한 통합문서) ·
* 「일위대가」 = labor(열마다 문서 · 39장) ·
@@ -31,42 +31,6 @@ export interface TemplateDoc {
문서: unknown;
}
/** 서버가 판 불일치로 막았을 때 · `detail` = 서버 몸 그대로(729-3 `{까닭, 남은줄}`) */
export class StaleError extends Error {
constructor(
message: string,
readonly detail?: unknown,
) {
super(message);
}
}
/** `/api/m02` 아래 길 부름 — 409 = StaleError · 그 밖 실패 = 서버 까닭 글(하위 폴더도 씀) */
export async function call<T>(path: string, init: RequestInit = {}): Promise<T> {
const response = await fetch(`${API_BASE_URL}/m02${path}`, {
credentials: "include",
headers: { "Content-Type": "application/json" },
...init,
});
const body = (await response.json().catch(() => ({}))) as { detail?: unknown } & T;
if (response.status === 409)
throw new StaleError(reason(body.detail, response.status), body.detail);
if (!response.ok) throw new Error(reason(body.detail, response.status));
return body;
}
/** 서버가 막은 까닭 그대로 — 문장 · `{errors: [...]}` · 입력 검사 목록(`[{msg}]`) */
function reason(detail: unknown, status: number): string {
if (typeof detail === "string") return detail;
const why = (detail as { 까닭?: unknown } | null)?.까닭;
if (typeof why === "string") return why;
const list = Array.isArray(detail) ? detail : (detail as { errors?: unknown } | null)?.errors;
const lines = Array.isArray(list)
? list.map((x) => (typeof x === "string" ? x : String((x as { msg?: unknown })?.msg ?? "")))
: [];
return lines.filter(Boolean).join(" · ") || `HTTP ${status}`;
}
/** 지금 화면의 층 — 시스템 · 회사 · 개인 모두 `/layers/{층}` 아래(구조물집계표 · 조합 길 모두 · 읽기는
* 로그인 누구나 · 쓰기는 서버 층 권한 · 옛 `/api/m02/templates/*` 는 시스템 관리자 전용이라 안 씀) ·
* `owner` = 남의 층을 볼 때 주인(회사 `{C}` · 개인 `{C}/{U}` · 자기 층 = null · PLAN 27-1c) —
@@ -46,6 +46,7 @@ import { listLayerDocs, SANGEUN_KIND, type SangeunRow } from "./M02_MasterTemple
import { logicHeads as heads } from "./logic/M02_Find_Heads";
import "../M01_MasterData/M01_MasterData_UI_Logic_Style.css"; // 창 겉틀
import "./M02_MasterTemplete_Labor.css";
import type { StackFindKind } from "../A00_Common/line_stack_pick";
type Scope = Omit<LaborRef, "키">;
type Tab = "m01" | "sk" | "pre";
@@ -66,7 +67,7 @@ export interface M01Element {
}
/** 고를 수 있는 종류 — logic = M01 단가산출 · 기초 로직 · labor = 인력 · material = 재료 · machine = 기계 · sk = M02 단가산출 · pre = 일위대가 */
export type FindKind = "logic" | "labor" | "material" | "machine" | "oil" | "sk" | "pre";
export type FindKind = StackFindKind; // 856-4 — 공용 줄 쌓기 창 종류와 한 벌
export interface FindPickOptions {
layer: Layer;
@@ -21,6 +21,7 @@ import { openStackPick } from "../A00_Common/line_stack_pick";
import { call } from "./M02_MasterTemplete_Api_Fetch";
import { at, type HopyoScope } from "./M02_MasterTemplete_Hopyo_Api";
import { placeNote } from "../M01_MasterData/M01_MasterData_Api_Fetch";
import { openFindPicker } from "./M02_MasterTemplete_Find_Pick";
export interface MatCand {
키: string;
@@ -120,6 +121,7 @@ export function createMatPick(opt: { scope: HopyoScope; key: string; target: Hop
iconStart: "search",
onClick: () =>
openStackPick(
openFindPicker,
"재료",
(p) => set(k, { 키: p.키, 이름: p.이름, 규격: p.규격 ?? "", 단위: p.단위 ?? "" }),
undefined,
@@ -53,7 +53,7 @@ import { openMatModal, openRowModal } from "./M02_MasterTemplete_Labor_RowModal"
import { tc } from "./M02_MasterTemplete_Labor_Text";
import { insideKeys } from "./M02_Labor_LogicMats_Model";
import { valueLine } from "./M02_Labor_Values_Model";
import { createUnitPick, NO_UNIT } from "./DataFlow/M02_DF_UnitPick";
import { createUnitPick, NO_UNIT } from "@ui/ui_template_unit_pick";
import { libMeta } from "./M02_MasterTemplete_Labor_LibMeta";
import "../M01_MasterData/M01_MasterData_UI_Logic_Style.css";
import "../M01_MasterData/M01_MasterData_UI_LogicLab_Style.css";
@@ -10,6 +10,7 @@
import { createStackScreen } from "../A00_Common/line_stack_screen";
import { el } from "@ui/ui_template_elements";
import type { Layer } from "./M02_MasterTemplete_Api_Fetch";
import { openFindPicker } from "./M02_MasterTemplete_Find_Pick";
export interface SkEquationOptions {
scope: { layer: Layer; owner: string | null };
@@ -48,6 +49,7 @@ export function createSangeunTabs(opt: SkEquationOptions): {
} {
const tools = el("span", { className: "m02-sk__tools", attrs: { "data-sk-tools": "" } }); // [단가 갱신] · [재생성](808-1)
const stack = createStackScreen({
find: openFindPicker, // 856-4 찾아 넣기 창
base: "",
admin: opt.edit,
cache: "m02_sk_doc_drafts",
+1 -1
View File
@@ -12,7 +12,7 @@ import { createButton, createInputField, el, showToast } from "@ui/ui_template_e
import { openModal } from "@ui/ui_template_modal";
import { searchMaterials } from "../M01_MasterData/M01_MasterData_Api_Fetch";
import { call } from "./M02_MasterTemplete_Api_Fetch";
import { createUnitPick, NO_UNIT } from "./DataFlow/M02_DF_UnitPick";
import { createUnitPick, NO_UNIT } from "@ui/ui_template_unit_pick";
import { createBadge } from "@ui/ui_template_badge";
import { createText } from "@ui/ui_template_text";
import { createEmpty } from "@ui/ui_template_empty";
+2
View File
@@ -37,6 +37,7 @@ import { StaleError } from "./M02_MasterTemplete_Api_Fetch";
import { confirmMyMachineImpact } from "./M02_MyMachine_Impact";
import { mt } from "./M02_MyMachine_Text";
import "./M02_MyMachine.css";
import { openFindPicker } from "./M02_MasterTemplete_Find_Pick";
export interface MyMachineFormOptions {
owner: string | null;
@@ -109,6 +110,7 @@ export async function mountMyMachineForm(
let m01Same = false;
const sheet = createMachineSheet({
find: openFindPicker, // 856-4
orig: start,
mine: true,
readOnly: false,
+1 -1
View File
@@ -12,7 +12,7 @@ import { createButton } from "@ui/ui_template_button";
import { createDataTable } from "@ui/ui_template_data_table";
import { createInputField, el, showConfirmDialog, showToast } from "@ui/ui_template_elements";
import { createText } from "@ui/ui_template_text";
import { createUnitPick, NO_UNIT } from "./DataFlow/M02_DF_UnitPick";
import { createUnitPick, NO_UNIT } from "@ui/ui_template_unit_pick";
import {
addMyMaterial,
dropMyMaterial,
+47
View File
@@ -0,0 +1,47 @@
/* =============================================================================
* common_util_m02_call.ts
* M02 서버 길 부름(PLAN 856-4) — 층 이름 · `/api/m02` 아래 부름 한 함수 · 409 = 판 다름.
* M02 화면(`M02_MasterTemplete_Api_Fetch` 가 그대로 내보냄)과 공용 줄 쌓기 화면(`A00_Common/line_stack_*`)이 같이 씀
* — 공용 화면이 M02 를 거꾸로 부르지 않게
* ========================================================================== */
import { API_BASE_URL } from "@config/config_frontend";
/** 층 이름 — 서버와 같은 글 */
export type Layer = "system" | "company" | "personal" | "project";
/** 서버가 판 불일치로 막았을 때 · `detail` = 서버 몸 그대로(729-3 `{까닭, 남은줄}`) */
export class StaleError extends Error {
constructor(
message: string,
readonly detail?: unknown,
) {
super(message);
}
}
/** `/api/m02` 아래 길 부름 — 409 = StaleError · 그 밖 실패 = 서버 까닭 글(하위 폴더도 씀) */
export async function call<T>(path: string, init: RequestInit = {}): Promise<T> {
const response = await fetch(`${API_BASE_URL}/m02${path}`, {
credentials: "include",
headers: { "Content-Type": "application/json" },
...init,
});
const body = (await response.json().catch(() => ({}))) as { detail?: unknown } & T;
if (response.status === 409)
throw new StaleError(reason(body.detail, response.status), body.detail);
if (!response.ok) throw new Error(reason(body.detail, response.status));
return body;
}
/** 서버가 막은 까닭 그대로 — 문장 · `{errors: [...]}` · 입력 검사 목록(`[{msg}]`) */
function reason(detail: unknown, status: number): string {
if (typeof detail === "string") return detail;
const why = (detail as { 까닭?: unknown } | null)?.까닭;
if (typeof why === "string") return why;
const list = Array.isArray(detail) ? detail : (detail as { errors?: unknown } | null)?.errors;
const lines = Array.isArray(list)
? list.map((x) => (typeof x === "string" ? x : String((x as { msg?: unknown })?.msg ?? "")))
: [];
return lines.filter(Boolean).join(" · ") || `HTTP ${status}`;
}
+1 -1
View File
@@ -213,7 +213,7 @@ const noop = () => undefined;
const load = makeLoader({
katex: { render: (t, box) => (box.tex = t) },
formula_doc_options: { machineText: () => null, optionText: (x) => x, liveOptions: (l) => l, nameMachines: noop },
M02_DF_UnitPick: {
ui_template_unit_pick: {
NO_UNIT: "(단위 없음)",
createUnitPick: (o) => Object.assign(new FakeNode("select"), { value: o.value }),
},
+1 -1
View File
@@ -198,7 +198,7 @@ const stubs = {
M02_MasterTemplete_Labor_Grid: {
laborBlock: (cur) => ({ lines: cur.담은로직.map(() => ({ note: "", amounts: { sum: 1 } })) }),
},
M02_DF_UnitPick: { createUnitPick: () => box("div"), NO_UNIT: "-" },
ui_template_unit_pick: { createUnitPick: () => box("div"), NO_UNIT: "-" },
M02_MasterTemplete_Labor_Unlinked: { unlinkedBar: () => null },
M02_MasterTemplete_Labor_Text: { tc: (k) => k },
M02_MasterTemplete_Labor_LibMeta: { libMeta: () => [] },
-1
View File
@@ -121,7 +121,6 @@ def test_736_1_항목_추가_찾기_창_하나():
assert "material: lib.material," in pick
find = _text(M02 / "M02_MasterTemplete_Find_Pick.ts")
assert 'kind === "재료" && opt.material' in find and "? opt.material" in find
assert '"logic" | "labor" | "material" | "machine" | "oil" | "sk" | "pre"' in find # 785-3 oil
def test_736_2_빠진_길_둘_신규_자재_기계_탭():
@@ -4,9 +4,7 @@ import re
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
M01 = ROOT / "M01_MasterData"
SHEET_CSS = (ROOT / "A00_Common" / "calc_sheet.css").read_text(encoding="utf-8")
STYLE = (M01 / "M01_MasterData_UI_LogicLab_Style.css").read_text(encoding="utf-8")
def test_옵션_격자_폭_따라_6_4_3_2_1():
@@ -18,12 +16,3 @@ def test_옵션_격자_폭_따라_6_4_3_2_1():
assert "container-type: inline-size" in SHEET_CSS # 창 폭이 아니라 상자 폭 기준
def test_합계_한_줄_바닥_고정():
foot = STYLE[STYLE.index(".m01lab__foot {") :]
foot = foot[: foot.index("}")]
assert "position: sticky" in foot and "bottom: 0" in foot
assert "repeat(4, minmax(0, 1fr))" in foot
assert "overflow: clip" in STYLE # 메인 칸이 굴림 칸이면 바닥에 안 붙음
foot_ts = (M01 / "M01_MasterData_UI_LogicLab_Foot.ts").read_text(encoding="utf-8")
assert 'className: "m01lab__foot"' in foot_ts # 748-3 두 보기가 같은 바닥 줄 부품
assert 'data-cols="3"' in STYLE
@@ -177,7 +177,7 @@ def test_요소키_기호_이름_0_전수() -> None:
def test_단위_고르기_공용_친글() -> None:
edit = _src("A00_Common/line_stack_edit.ts")
assert "createUnitPick({" in edit and "free: true," in edit
pick = _src("M02_MasterTemplete/DataFlow/M02_DF_UnitPick.ts")
pick = _src("ui_template/ui_template_unit_pick.ts")
assert "if (opts.free && typed && !all.includes(typed)) shown.push(typed);" in pick
main = _src("main.py")
at = main.index("M02_MasterTemplete.DataFlow.M02_DF_Router")
@@ -275,7 +275,7 @@ def test_단위표_더한_단위_문서_전수() -> None:
assert len(lines) > 5000
missing = {u for u in lines if u and same.get(u, u) not in units}
assert not missing, missing
pick = _src("M02_MasterTemplete/DataFlow/M02_DF_UnitPick.ts")
pick = _src("ui_template/ui_template_unit_pick.ts")
assert (
'...(table["더한 단위"] ?? []),' in pick and '(u && table["같은 단위"]?.[u]) || u' in pick
)
@@ -1,4 +1,4 @@
/* 51-5 — 단위 고르기 단추(공용 M02_DF_UnitPick) 높이 · 글자 = [저장] 단추와 같음
/* 51-5 — 단위 고르기 단추(공용 ui_template_unit_pick) 높이 · 글자 = [저장] 단추와 같음
* 시작 화면: M02 마스터 템플릿 · 마스터 층(#/m02-master-template?open=구조물조합&root=master) · 시스템 관리자
* 부르는 법: orca eval --expression "$(tr '\n' ' ' < 이 파일)" (async 식 · JSON 글을 돌려줌)
* 하는 일: item1 → 일위대가 [수정] 상세 → 단위 단추 · [저장] 단추 높이 · 글자 크기 잼
+16 -4
View File
@@ -1,6 +1,6 @@
/* =============================================================================
* M02_DF_UnitPick.ts
* 단가산출 흐름도 공용 단위 고르기 — 치면 걸러진 목록 · 고르기만(손글 안 받음 · `free` = 목록에 없는 친 글도 씀) · 「-」 = 없음
* ui_template_unit_pick.ts
* 공용 단위 고르기(856-4 — 옛 M02 `DataFlow/M02_DF_UnitPick`) — 치면 걸러진 목록 · 고르기만(손글 안 받음 · `free` = 목록에 없는 친 글도 씀) · 「-」 = 없음
* 목록 = 단위 표준(산림품셈 1-2-2) 단위 + 표의 「더한 단위」(수식 문서 줄 단위) + 부른 쪽이 주는 마스터 결과단위 등 + 원 · 「같은 단위」(kg → ㎏) 는 하나만
* 표준 표 읽는 길은 `setUnitSource` 로 바꿔 끼움(기본 = 서버 /standards) — 다른 판도 이것을 씀
* 글 [한, 영] 짝은 아래 TEXT
@@ -9,8 +9,8 @@
import { currentLanguageIndex } from "@ui/ui_template_locale";
import { createButton, el } from "@ui/ui_template_elements";
import type { UiSize } from "@ui/ui_template_button";
import { cfStandards } from "./M02_DF_Api";
import "./M02_DF_UnitPick.css";
import { API_BASE_URL } from "@config/config_frontend";
import "./ui_template_unit_pick.css";
import { createEmpty } from "@ui/ui_template_empty";
import "@ui/ui_template_list_row.css";
@@ -22,6 +22,18 @@ const TEXT = {
Pick: ["단위 고르기", "Pick a unit"],
} as const;
/** 단위 표준 표 */
interface CfStandards {
unit: { 이름: string; 줄: Record<string, unknown>[]; [k: string]: unknown };
saved: boolean;
}
async function cfStandards(): Promise<CfStandards> {
const response = await fetch(`${API_BASE_URL}/m02/df/standards`, { credentials: "include" });
if (!response.ok) throw new Error(`표준 표 읽기 실패 (${response.status})`);
return (await response.json()) as CfStandards;
}
const tu = (key: keyof typeof TEXT): string => TEXT[key][currentLanguageIndex === 1 ? 1 : 0];
/** 「없음」 을 뜻하는 단위 글 */