refactor(853-1): M01 화면 죽은 것 걷음 — 묶음 ①

- 지움: UI_Logic_Pick.ts(부르는 곳 0) · UI_Logic_Edit.ts(buildEditor · qtyKind 죽음 · 남은 formatNumber 는 공용 다시 내보내기뿐) · UI_Tree.ts(공용 트리 다시 내보내기 껍데기)
- Logic_Note: buildNote 와 그것만 쓰던 relatedFinds · matchRow · tableView 등 걷음(살아 있는 loadTable · explain 남김)
- LogicLab_Foot.FOOT_OF · Draft.fileCount 걷음(부르는 곳 0)
- 글 키: Logic_Text 62 · LogicLab_Text 11 걷음(정적 · 동적 부름 0 · typecheck 가 지킴)
- import 를 본래 자리로: formatNumber · formatMoney 등 → common_util_money · renderTree → @ui/ui_template_tree
- UI_Logic_Money.ts 는 남김 — M02 네 파일이 import(sub2 몫)
- 시험: test_782_1 소유 선택지 시험 지움(죽은 buildEditor 글만 봄) · test_208_1 · test_modal_top 경로 목록에서 Logic_Pick 줄 뺌 · helper_717_1 의 Logic_Edit 가짜 모듈 뺌

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 11:35:53 +09:00
co-authored by Claude Opus 5.5
parent 45490575f8
commit 604ab2cb73
16 changed files with 16 additions and 1030 deletions
-1
View File
@@ -77,7 +77,6 @@ export function peek(file: string): FileDraft | undefined {
const countOf = (d: FileDraft): number =>
Object.keys(d.edits).length + d.adds.length + d.deletes.length + Object.keys(d.tables).length;
export const fileCount = (file: string): number => (store[file] ? countOf(store[file]) : 0);
export const totalCount = (): number => Object.values(store).reduce((n, d) => n + countOf(d), 0);
/** 그 파일을 초안이 받은 판본과 다른 판본으로 읽었나 — 저장하면 409 로 막힐 초안. */
@@ -7,18 +7,12 @@
import { createCalcFormulaRow } from "@ui/ui_template_calc_row";
import { el } from "@ui/ui_template_elements";
import { formatMoney } from "./M01_MasterData_UI_Logic_Money";
import { formatMoney } from "../common_util/common_util_money";
import { tl } from "./M01_MasterData_UI_LogicLab_Text";
export type FootKey = "labor" | "material" | "cost";
const LABEL: Record<FootKey, string> = { labor: "노무비", material: "재료비", cost: "경비" };
export const FOOT_KEYS = Object.keys(LABEL) as FootKey[];
/** 서버 비목 이름 → 칸 */
export const FOOT_OF: Record<string, FootKey> = {
노무비: "labor",
재료비: "material",
경비: "cost",
};
/** 비목 소계 줄 — `total` 을 주면 맨 끝 「계」 칸까지 네 칸(주지 않으면 세 칸) */
export function buildFoot(
@@ -28,8 +28,12 @@ import type {
TextPiece,
} from "./M01_MasterData_UI_Logic_Api";
import { pctView } from "./M01_MasterData_UI_Logic_Api";
import { formatNumber } from "./M01_MasterData_UI_Logic_Edit";
import { formatLineMoney, formatMoney, formatPrice } from "./M01_MasterData_UI_Logic_Money";
import {
formatLineMoney,
formatMoney,
formatNumber,
formatPrice,
} from "../common_util/common_util_money";
import { tx } from "./M01_MasterData_UI_Logic_Text";
import { coverForm, type CoverPart, type LineCover } from "./M01_MasterData_UI_LogicLab_Cover";
import {
@@ -20,8 +20,7 @@ import {
} from "./M01_MasterData_UI_Logic_Api";
import { fetchRows, type Row } from "./M01_MasterData_Api_Fetch";
import { createStat, statGrid } from "@ui/ui_template_stat";
import { formatNumber } from "./M01_MasterData_UI_Logic_Edit";
import { formatMoney, formatPrice } from "./M01_MasterData_UI_Logic_Money";
import { formatMoney, formatNumber, formatPrice } from "../common_util/common_util_money";
import { explain, loadTable, type TableRow } from "./M01_MasterData_UI_Logic_Note";
import { hasMasterJump, jumpToMaster, type MasterJump } from "./M01_MasterData_UI_Side";
import { fragmentRow, type Fragment } from "./M01_MasterData_UI_LogicLab_Pill";
@@ -22,11 +22,6 @@ const TEXT = {
],
Ho_Title: ["단가산출 상세", "Unit-price detail"],
View_Equation: ["수식", "Equation"],
G_labor: ["인력", "Labor"],
G_material: ["재료", "Material"],
G_cost: ["경비", "Expense"],
G_other: ["그 밖 (인력·자재·경비 어디에도 안 맞는 줄)", "Other (fits none of the three)"],
Tag_Table: ["표", "Table"],
Subtotal: ["소계", "Subtotal"],
Share: ["몫", "Share"],
Total: ["계", "Total"],
@@ -34,17 +29,13 @@ const TEXT = {
Col_Name: ["이름", "Name"],
Col_Unit: ["단위", "Unit"],
Col_Qty: ["수량", "Quantity"],
Col_Logic: ["로직", "Logic"],
Col_Price: ["단가", "Price"],
Col_Amount: ["금액", "Amount"],
Empty_Group: ["줄 없음", "No lines"],
Modal_Close: ["닫기", "Close"],
Pill_Tone: ["요소 연결", "Linked element"],
Modal_Sum: ["한 줄 풀이", "In one line"],
Pill_Hint: ["쓰인 자료 — 누르면 펼침", "Data used — tap to open"],
Modal_UnitPrice: ["단가", "Unit price"],
Pill_Table: ["표", "Table"],
Pill_Logic: ["로직", "Logic"],
Pill_Go: ["마스터 화면에서 보기", "Open in master"],
Pill_Back: ["← 단가산출 기초로 돌아가기", "← Back to unit-price logic"],
Pill_NoPick: [
@@ -54,7 +45,6 @@ const TEXT = {
Pill_Unresolved: ["입력이 비어 풀리지 않음", "Not resolved — input empty"],
Pill_NoValue: ["관리자 값 미확보 — 마스터에 단가가 없음", "No price in master yet"],
Modal_Qty: ["수량 식", "Quantity formula"],
Modal_Price: ["단가 자료", "Price source"],
Modal_Value: ["값", "Value"],
Modal_Source: ["출처", "Source"],
Modal_Spec: ["규격", "Spec"],
@@ -68,7 +58,6 @@ const TEXT = {
],
Modal_Find: ["이름 · 규격으로 찾기", "Search by name or spec"],
Modal_Logic: ["다른 로직을 부름", "Calls another logic"],
Modal_NoData: ["표나 단가 자료가 없는 줄 — 수량 식만 있음", "No table or price data"],
Modal_Hit: ["노란 줄 = 지금 넣은 값으로 걸린 줄", "Highlighted row matches the trial values"],
Modal_ColOnly: [
"진한 칸 = 찾은 값 칸 — 서버가 줄 자리는 안 줌",
@@ -21,8 +21,7 @@ import {
showItems,
} from "./M01_MasterData_UI_Logic_CalcPick";
import { autoFill, driveRun } from "./M01_MasterData_UI_Logic_Drive";
import { formatNumber } from "./M01_MasterData_UI_Logic_Edit";
import { formatLineMoney, formatMoney } from "./M01_MasterData_UI_Logic_Money";
import { formatLineMoney, formatMoney, formatNumber } from "../common_util/common_util_money";
import { safeReason, tx } from "./M01_MasterData_UI_Logic_Text";
import { createBadge } from "@ui/ui_template_badge";
import { createDivider } from "@ui/ui_template_divider";
@@ -1,445 +0,0 @@
/* =============================================================================
* M01_MasterData_UI_Logic_Edit.ts
* 로직 한 줄 고치기 — 실무 단가산출 상세(호표) 모양
* 머리(이름·결과단위·출처·소유) · 설계에서 받을 값 · 호표 줄 · 중간 값 · 결과 식 · 덧줄 · 끝수
*
* 칸을 고치면 `row` 를 그 자리에서 바꾸고 `onChange` 만 부름(다시 그리지 않음).
* 줄 더하기·지우기 · 요소 고르기처럼 모양이 바뀔 때만 `rerender`.
* ========================================================================== */
import { createButton, createSelectField, el } from "@ui/ui_template_elements";
import type {
CalcLine,
ElementBrief,
HoLine,
LogicInput,
LogicRow,
NamedFormula,
} from "./M01_MasterData_UI_Logic_Api";
import { tx } from "./M01_MasterData_UI_Logic_Text";
import { createBadge } from "@ui/ui_template_badge";
import { createCalcFormula } from "@ui/ui_template_calc_row";
import { createText } from "@ui/ui_template_text";
import { createIconButton } from "@ui/ui_template_button";
import { formatLineMoney, formatNumber, formatPrice } from "../common_util/common_util_money";
export type PickMode = "element" | "table";
export type PickDone = (item: ElementBrief, column?: string) => void;
export interface EditContext {
row: LogicRow;
file: string;
isNew: boolean;
files: string[];
reasons: string[];
prices: Record<string, ElementBrief | null>;
/** 마지막 시험 계산의 줄 — 호표 차례와 같음(덧줄은 뒤에 붙음) */
lines: CalcLine[] | null;
onChange: () => void;
onFile: (file: string) => void;
onPick: (mode: PickMode, group: string, done: PickDone) => void;
}
const KINDS = ["인력", "재료", "기계", "로직"];
/** 키 앞 테이블ID → 그룹(`resources/master_data/scripts/master_keys.py` TABLES). */
const groupOf = (key: string): string =>
key.startsWith("LB")
? "인력"
: key.startsWith("M")
? "재료"
: key.startsWith("EQ")
? "기계"
: key.startsWith("G")
? "로직"
: "";
const COSTS = ["노무비", "재료비", "경비"];
const COST_OF: Record<string, string> = { 인력: "노무비", 재료: "재료비", 기계: "경비" };
export { formatNumber };
function textBox(value: unknown, onInput: (v: string) => void, className = ""): HTMLInputElement {
const input = el("input", {
className: `ui-input ui-input--sm m01-logic__input ${className}`,
attrs: { type: "text" },
});
input.value = value === null || value === undefined ? "" : String(value);
input.addEventListener("input", () => onInput(input.value));
return input;
}
function choice(
options: string[],
value: string | undefined,
onPick: (v: string) => void,
): HTMLElement {
const all = value && !options.includes(value) ? [value, ...options] : options;
return createSelectField({
options: all.map((o) => ({ value: o, text: o })),
value: value ?? options[0],
compact: true,
onChange: onPick,
}).root;
}
function dropButton(onClick: () => void): HTMLButtonElement {
const button = createIconButton({ glyph: "×", title: tx("DeleteRow"), size: 20, onClick });
button.classList.add("m01-logic__drop");
return button;
}
function section(title: string, body: HTMLElement, onAdd?: () => void): HTMLElement {
const head = el("div", {
className: "m01-logic__section-head",
children: [el("h3", { text: title })],
});
if (onAdd) head.append(createButton({ label: tx("AddRow"), variant: "ghost", onClick: onAdd }));
return el("section", { className: "m01-logic__section", children: [head, body] });
}
function grid(headers: string[], rows: HTMLElement[][], className: string): HTMLElement {
const table = el("table", { className: `ui-table ui-table--data m01-logic__grid ${className}` });
table.append(
el("thead", { children: [el("tr", { children: headers.map((h) => el("th", { text: h })) })] }),
);
const body = el("tbody");
for (const cells of rows)
body.append(el("tr", { children: cells.map((c) => el("td", { children: [c] })) }));
table.append(body);
return el("div", { className: "m01-logic__scroll", children: [table] });
}
/** 식 칸 — 읽기만(고침은 「시트」 보기 식 칸 · 칠 때마다 검사 · 794-1) */
const sheetOnly = (formula: string): HTMLElement => {
const box = createCalcFormula(formula || "—");
box.dataset.sheetOnly = "";
return box;
};
export function qtyKind(qty: string): string {
const text = qty.trim();
if (/^-?\d+(\.\d+)?$/.test(text)) return tx("Ho_QtyNumber");
if (text.startsWith("찾기(")) return tx("Ho_QtyTable");
return tx("Ho_QtyFormula");
}
export function buildEditor(host: HTMLElement, ctx: EditContext): void {
const rerender = (): void => {
ctx.onChange();
buildEditor(host, ctx);
};
const row = ctx.row;
const set = (patch: () => void): void => {
patch();
ctx.onChange();
};
host.innerHTML = "";
host.append(head(ctx, set, rerender));
if (ctx.reasons.length) {
host.append(
el("div", {
className: "ui-banner ui-banner--danger m01-logic__reasons",
children: [
el("strong", { text: tx("Head_Blocked") }),
...ctx.reasons.map((r) => el("div", { text: r })),
],
}),
);
}
host.append(inputsSection(row, set, rerender));
const money = !("결과" in row) && (row.결과단위 ?? "").startsWith("원");
if (money) host.append(hoSection(ctx, set, rerender));
host.append(middleSection(row, set, rerender));
if (!money) {
const formula = textBox(row.결과?.식 ?? "", (v) =>
set(() => {
row.결과 = { 식: v };
}),
);
host.append(section(tx("Result_Title"), formula));
} else {
host.append(extraSection(row, set, rerender));
const rounding = textBox(row.끝수 ?? "", (v) =>
set(() => {
row.끝수 = v.trim() ? v : null;
}),
);
host.append(section(tx("Rounding"), rounding));
}
}
function field(label: string, control: HTMLElement, wide = false): HTMLElement {
return el("label", {
className: `m01-logic__field${wide ? " m01-logic__field--wide" : ""}`,
children: [el("span", { text: label }), control],
});
}
function head(ctx: EditContext, set: (p: () => void) => void, rerender: () => void): HTMLElement {
const row = ctx.row;
const file = ctx.isNew
? choice(ctx.files, ctx.file, (v) => ctx.onFile(v))
: el("span", { className: "m01-logic__file", text: ctx.file });
const unit = textBox(row.결과단위, (v) => set(() => (row.결과단위 = v)));
unit.addEventListener("change", rerender); // 돈 로직 ↔ 돈 아닌 로직 칸이 바뀜
const note = el("textarea", {
className: "ui-input ui-input--sm m01-logic__input m01-logic__note",
});
note.value = row.비고 ?? "";
note.addEventListener("input", () =>
set(() => {
if (note.value.trim()) row.비고 = note.value;
else delete row.비고;
}),
);
return el("div", {
className: "m01-logic__head",
children: [
field(tx("Head_File"), file, true),
field(
tx("Head_Key"),
el("span", { className: "ui-text ui-text--muted", text: row.키 || tx("New_Key") }),
),
field(
tx("Head_Number"),
textBox(row.원문번호, (v) => set(() => (row.원문번호 = v))),
),
field(
tx("Head_Name"),
textBox(row.이름, (v) => set(() => (row.이름 = v))),
),
field(tx("Head_Unit"), unit),
field(
tx("Head_Source"),
textBox(row.출처, (v) => set(() => (row.출처 = v))),
),
field(
tx("Head_Owner"),
choice(["현장", "공용"], row.소유, (v) => set(() => (row.소유 = v))),
),
field(tx("Head_Note"), note, true),
],
});
}
function inputsSection(
row: LogicRow,
set: (p: () => void) => void,
rerender: () => void,
): HTMLElement {
const list = row.입력 ?? [];
const rows = list.map((spec: LogicInput, i) => {
const low = textBox(spec.범위?.[0] ?? "", () => range(), "m01-logic__num");
const high = textBox(spec.범위?.[1] ?? "", () => range(), "m01-logic__num");
const range = (): void =>
set(() => {
if (low.value.trim() === "" && high.value.trim() === "") delete spec.범위;
else spec.범위 = [Number(low.value), Number(high.value)];
});
return [
textBox(spec.이름, (v) => set(() => (spec.이름 = v))),
textBox(spec.단위 ?? "", (v) =>
set(() => {
if (v.trim()) spec.단위 = v;
else delete spec.단위;
}),
),
textBox((spec.고르기 ?? []).join(", "), (v) =>
set(() => {
const items = v
.split(",")
.map((x) => x.trim())
.filter(Boolean);
// 모두 수면 수로 — 글 "35" 로 적으면 표의 35 와 안 맞음
const numbers = items.every((x) => !Number.isNaN(Number(x)));
if (items.length) spec.고르기 = numbers ? items.map(Number) : items;
else delete spec.고르기;
}),
),
el("div", {
className: "m01-logic__range",
children: [low, el("span", { text: "∼" }), high],
}),
dropButton(() => {
list.splice(i, 1);
rerender();
}),
];
});
const headers = [
tx("Head_Name"),
tx("Inputs_Unit"),
tx("Inputs_Choices"),
tx("Inputs_Range"),
"",
];
return section(tx("Inputs_Title"), grid(headers, rows, "m01-logic__grid--inputs"), () => {
(row.입력 ??= []).push({ 이름: "" });
rerender();
});
}
function priceCell(ctx: EditContext, item: HoLine, i: number): HTMLElement {
const line = ctx.lines?.[i];
if (line) return el("span", { className: "m01-logic__money", text: formatPrice(line.단가) });
if (item.종류 === "로직" || item.요소.includes("{")) {
return el("span", { className: "ui-text ui-text--muted", text: tx("Ho_PriceLater") });
}
const brief = ctx.prices[item.요소];
if (brief === undefined) return el("span", { className: "ui-text ui-text--muted", text: "" });
if (brief === null) return createText(tx("Ho_Missing"), "error");
return el("span", { className: "m01-logic__money", text: formatPrice(brief.값) });
}
function hoSection(
ctx: EditContext,
set: (p: () => void) => void,
rerender: () => void,
): HTMLElement {
const list = ctx.row.호표 ?? [];
const rows = list.map((item: HoLine, i) => {
const element = textBox(item.요소, (v) => set(() => (item.요소 = v)), "m01-logic__ref");
const pick = createButton({
label: tx("Ho_Pick"),
variant: "ghost",
onClick: () =>
ctx.onPick("element", item.종류, (found) => {
const group = groupOf(found.ref);
item.요소 = group === "로직" ? `로직(${found.ref})` : found.ref;
if (KINDS.includes(group)) item.종류 = group;
item.이름 = found.이름 ?? item.이름;
if (found.규격) item.규격 = found.규격;
else delete item.규격;
if (!item.비목 && COST_OF[item.종류]) item.비목 = COST_OF[item.종류];
if (group !== "로직") ctx.prices[found.ref] = found;
rerender();
}),
});
const brief = ctx.prices[item.요소];
const spec = item.규격 ?? brief?.규격 ?? "";
const qty = sheetOnly(item.수량); // 794-1 식 = 「시트」 보기 식 칸(날 입력칸 갈음)
const tag = createBadge(qtyKind(item.수량), "accent");
const table = createButton({
label: tx("Ho_PickTable"),
variant: "ghost",
onClick: () =>
ctx.onPick("table", "소요량", (found, column) => {
const ref = found.ref;
item.수량 = `찾기(${ref})${column ? `.${column}` : ""}`;
rerender();
}),
});
const cost =
item.종류 === "로직" && !item.비목
? choice(["", ...COSTS], "", (v) => set(() => (item.비목 = v || undefined)))
: choice(COSTS, item.비목, (v) => set(() => (item.비목 = v)));
return [
choice(KINDS, item.종류, (v) => {
item.종류 = v;
rerender();
}),
el("div", { className: "m01-logic__pair", children: [element, pick] }),
el("div", {
className: "m01-logic__stack",
children: [
textBox(item.이름 ?? "", (v) => set(() => (item.이름 = v))),
el("span", { className: "ui-text ui-text--muted", text: spec }),
],
}),
textBox(item.단위 ?? "", (v) => set(() => (item.단위 = v)), "m01-logic__unit"),
el("div", { className: "m01-logic__pair", children: [tag, qty, table] }),
priceCell(ctx, item, i),
el("span", {
className: "m01-logic__money",
text: formatLineMoney(ctx.lines?.[i]?.금액 ?? ""),
}),
cost,
dropButton(() => {
list.splice(i, 1);
rerender();
}),
];
});
const headers = [
tx("Ho_Kind"),
tx("Ho_Element"),
tx("Ho_Name"),
tx("Ho_Unit"),
tx("Ho_Qty"),
tx("Ho_Price"),
tx("Ho_Amount"),
tx("Ho_Cost"),
"",
];
return section(tx("Ho_Title"), grid(headers, rows, "m01-logic__grid--ho"), () => {
(ctx.row.호표 ??= []).push({
종류: "인력",
요소: "",
이름: "",
단위: "인",
수량: "",
비목: "노무비",
});
rerender();
});
}
function formulaRows(
list: NamedFormula[],
set: (p: () => void) => void,
rerender: () => void,
withCost: boolean,
): HTMLElement[][] {
return list.map((item, i) => {
const cells: HTMLElement[] = [
textBox(item.이름, (v) => set(() => (item.이름 = v))),
sheetOnly(item.식),
];
if (withCost) {
cells.push(
choice(COSTS, item.비목, (v) => set(() => (item.비목 = v))),
textBox(item.출처 ?? "", (v) => set(() => (item.출처 = v))),
);
}
cells.push(
dropButton(() => {
list.splice(i, 1);
rerender();
}),
);
return cells;
});
}
function middleSection(
row: LogicRow,
set: (p: () => void) => void,
rerender: () => void,
): HTMLElement {
const list = row.중간 ?? [];
const table = grid(
[tx("Head_Name"), tx("Formula"), ""],
formulaRows(list, set, rerender, false),
"",
);
return section(tx("Middle_Title"), table, () => {
(row.중간 ??= []).push({ 이름: "", 식: "" });
rerender();
});
}
function extraSection(
row: LogicRow,
set: (p: () => void) => void,
rerender: () => void,
): HTMLElement {
const list = row.덧줄 ?? [];
const headers = [tx("Head_Name"), tx("Formula"), tx("Ho_Cost"), tx("Head_Source"), ""];
return section(
tx("Extra_Title"),
grid(headers, formulaRows(list, set, rerender, true), ""),
() => {
(row.덧줄 ??= []).push({ 이름: "", 식: "", 비목: "재료비", 출처: "" });
rerender();
},
);
}
+4 -176
View File
@@ -1,17 +1,12 @@
/* =============================================================================
* M01_MasterData_UI_Logic_Note.ts
* 설명 카드 — 식 하나를 쉬운 말로 풀고, 그 식이 기대는 원문 표를 미리 보임(걸린 줄 강조).
* 원문 표 읽기(`loadTable`) · 식 쉬운 말 풀이(`explain`).
*
* 순수 읽기 — `/elements` 로 표 파일을 찾고 `/table` 로 통째 읽어 그 자리에서 줄을 맞힘.
* 엔진을 다시 돌리지 않음(수량·금액은 `/calc` 답이 줌) — 여기서는 「어느 줄이 걸렸나」만 보임.
* 흐름 그림 상자(`…_Logic_Flow.ts`)와 테스트 방식 B 가 같이 씀.
* 순수 읽기 — `/elements` 로 표 파일을 찾고 `/table` 로 통째 읽음.
* ========================================================================== */
import { API_BASE_URL } from "@config/config_frontend";
import { el } from "@ui/ui_template_elements";
import { logicApiPaths, type ElementBrief, type NamedFormula } from "./M01_MasterData_UI_Logic_Api";
import { formatNumber } from "./M01_MasterData_UI_Logic_Edit";
import { tx } from "./M01_MasterData_UI_Logic_Text";
import { logicApiPaths, type ElementBrief } from "./M01_MasterData_UI_Logic_Api";
/* ── 원문 표(소요량·계수) 읽기 ─────────────────────────────────────────── */
@@ -60,13 +55,7 @@ export function loadTable(key: string): Promise<TableRow | null> {
return job;
}
/* ── 식 속 찾기(표, 조건...).칸 뽑기 ────────────────────────────────────── */
export interface FindCall {
table: string;
conds: [string, string][];
col: string;
}
/* ── 식 속 찾기(표, 조건...).칸 ──────────────────────────────────────── */
const FIND_RE = /찾기\(\s*([A-Za-z0-9_]+)\s*,([^)]*)\)\s*\.\s*([A-Za-z0-9_가-힣]+)/g;
@@ -81,78 +70,6 @@ function splitConds(raw: string): [string, string][] {
});
}
function findCalls(expr: string): FindCall[] {
const out: FindCall[] = [];
for (const m of expr.matchAll(FIND_RE)) {
out.push({ table: m[1], conds: splitConds(m[2]), col: m[3] });
}
return out;
}
/** 식 안에 이름이 낱말로 나오는지 — 한글엔 \b 가 안 먹어 앞뒤 글자를 직접 봄 */
function mentions(expr: string, name: string): boolean {
if (!name) return false;
const idx = expr.indexOf(name);
if (idx < 0) return false;
const isWord = (c: string | undefined) => !!c && /[A-Za-z0-9_가-힣]/.test(c);
return !isWord(expr[idx - 1]) && !isWord(expr[idx + name.length]);
}
export interface RelatedFind {
/** 「이 줄」 또는 물려 쓰는 중간 값 이름 */
source: string;
find: FindCall;
}
/** 이 줄 식이 기대는 찾기(...) — 자기 식 + (한 단계) 물려 쓰는 중간 식 */
export function relatedFinds(expr: string, middles: NamedFormula[]): RelatedFind[] {
const out: RelatedFind[] = findCalls(expr).map((find) => ({
source: tx("Note_ThisLine"),
find,
}));
for (const m of middles) {
if (!mentions(expr, m.이름)) continue;
for (const find of findCalls(m.식)) out.push({ source: m.이름, find });
}
return out;
}
/* ── 조건 값 풀기 · 표 줄 맞히기 ───────────────────────────────────────── */
export interface EvalCtx {
values: Record<string, string>;
middle: Record<string, unknown>;
}
function resolveIdent(name: string, ctx: EvalCtx): string | number | undefined {
const quoted = name.match(/^["'](.*)["']$/);
if (quoted) return quoted[1];
if (/^-?\d+(\.\d+)?$/.test(name)) return Number(name);
if (ctx.values[name] !== undefined && ctx.values[name] !== "") return ctx.values[name];
if (ctx.middle[name] !== undefined) return ctx.middle[name] as number;
return undefined;
}
function sameValue(a: unknown, b: unknown): boolean {
if (a === undefined || a === null || b === undefined) return false;
const na = Number(a);
const nb = Number(b);
if (!Number.isNaN(na) && !Number.isNaN(nb)) return na === nb;
return String(a) === String(b);
}
/** 지금 조건 값으로 찾기() 가 고를 줄 — 못 맞히면 null(값을 아직 안 골랐거나 후보 여럿) */
export function matchRow(
table: TableRow,
conds: [string, string][],
ctx: EvalCtx,
): Record<string, unknown> | null {
for (const row of table.줄 ?? []) {
if (conds.every(([col, rhs]) => sameValue(row[col], resolveIdent(rhs, ctx)))) return row;
}
return null;
}
/* ── 쉬운 말 풀이 — 찾기()/만약() 을 문장으로, 안 되면 식 그대로 ─────────── */
function splitTop(s: string): string[] {
@@ -200,92 +117,3 @@ export function explain(expr: string): string {
});
return expandIf(withFind).trim() || expr;
}
/* ── 카드 그리기 ──────────────────────────────────────────────────────── */
export interface NoteOptions {
/** 풀어 볼 식 — 호표 줄의 수량 · 중간 값·덧줄의 식 */
expr: string;
/** 물려 쓰는 중간 값(한 단계) */
middles: NamedFormula[];
ctx: EvalCtx;
}
/** 표 하나를 그림 — 지금 값으로 걸린 줄은 강조 */
function tableView(find: RelatedFind, table: TableRow, ctx: EvalCtx): HTMLElement[] {
const hit = matchRow(table, find.find.conds, ctx);
const cols = [...Object.keys(table.조건 ?? {}), ...Object.keys(table.값칸 ?? {})];
const body = (table.줄 ?? []).map((line) =>
el("tr", {
className: hit === line ? "m01c__hit" : "",
children: cols.map((c) => el("td", { text: formatNumber(line[c]) })),
}),
);
const use = table.용도
? [table.용도.공종, (table.용도.대상 ?? []).join("·")].filter(Boolean).join(" · ")
: "";
return [
el("p", {
className: "ui-text ui-text--muted",
text: `${find.source} · ${table.원문번호 ?? table.키} ${table.이름 ?? ""} (${table.출처 ?? ""})`,
}),
...(use
? [el("p", { className: "ui-text ui-text--muted", text: `${tx("Use_Of")} — ${use}` })]
: []),
el("table", {
className: "m01c__table",
children: [
el("thead", { children: [el("tr", { children: cols.map((c) => el("th", { text: c })) })] }),
el("tbody", { children: body }),
],
}),
];
}
/**
* 설명 카드를 `host` 에 채움 — 쉬운 말 풀이 · 원문 표 미리보기 · 고급(식 그대로).
* 표는 서버에서 읽어 오므로 먼저 「찾는 중」을 보이고 온 뒤 갈아 끼움.
*/
export function buildNote(host: HTMLElement, opts: NoteOptions): void {
const related = relatedFinds(opts.expr, opts.middles);
const advanced = el("details", {
className: "m01c__raw",
children: [el("summary", { text: tx("Note_Formula") }), el("pre", { text: opts.expr })],
});
const plain = explain(opts.expr);
const head: HTMLElement[] = [
el("p", { className: "ui-text ui-text--muted", text: tx("Note_Plain") }),
el("p", { className: "m01c__plain", text: plain }),
];
if (!related.length) {
host.replaceChildren(...head, advanced);
return;
}
const tables = el("div", {
className: "ui-text ui-text--muted",
text: `${tx("Note_Searching")}…`,
});
host.replaceChildren(
...head,
el("p", { className: "ui-text ui-text--muted", text: tx("Note_Table") }),
tables,
advanced,
);
void Promise.all(related.map(async (r) => ({ r, table: await loadTable(r.find.table) }))).then(
(got) => {
tables.className = "m01c__tables";
tables.replaceChildren(
...got.flatMap(({ r, table }) =>
table
? tableView(r, table, opts.ctx)
: [
el("p", {
className: "ui-text ui-text--muted",
text: tx("Note_TableMissing", { v: r.find.table }),
}),
],
),
);
},
);
}
@@ -1,296 +0,0 @@
/* =============================================================================
* M01_MasterData_UI_Logic_Pick.ts
* 고르기 두 가지
* ① 요소 찾기 창 — 그룹 전체에서 이름·키·원문번호로 찾아 호표 줄에 넣음(`GET /elements`)
* 로직 그룹은 별칭으로도 찾음(서버) · 별칭으로 맞은 줄은 그 별칭을 작게(공용 `matchLogic` · 208-1)
* 표 고르기(소요량·계수)는 값칸 단추를 눌러 `찾기(…).칸` 으로 수량에 넣음
* ② 재료·기계 바꿔 고르기 — 구분 → 상세구분 → 후보 순으로 좁힘
* 바꾼 것은 시험 계산용 복사본에만 · 정본 로직은 그대로
* ========================================================================== */
import {
createButton,
createInputField,
createSelectField,
el,
showToast,
} from "@ui/ui_template_elements";
import { aliasNote, matchLogic } from "@ui/ui_template_logic_find";
import {
fetchMaterials,
searchElements,
searchPrice,
type ElementBrief,
type HoLine,
type LogicOne,
type LogicRow,
} from "./M01_MasterData_UI_Logic_Api";
import { placeNote } from "./M01_MasterData_Api_Fetch";
import { formatNumber, type PickDone, type PickMode } from "./M01_MasterData_UI_Logic_Edit";
import { tx } from "./M01_MasterData_UI_Logic_Text";
import { openModal } from "@ui/ui_template_modal";
const GROUPS: Record<PickMode, string[]> = {
element: ["인력", "재료", "기계", "로직"],
table: ["소요량", "계수"],
};
export function openPicker(mode: PickMode, group: string, done: PickDone): void {
const groups = GROUPS[mode];
const groupField = createSelectField({
options: groups.map((g) => ({ value: g, text: g })),
value: groups.includes(group) ? group : groups[0],
compact: true,
});
const select = groupField.select;
const searchField = createInputField({ type: "search", placeholder: tx("Pick_Search") });
const search = searchField.input;
const count = el("span", { className: "ui-text ui-text--muted" });
const list = el("div", { className: "m01-logic__pick-list" });
// 모달 부품 — 제목줄 [닫기] · 바깥 누르기 · Esc · 위 고정
const { close } = openModal({
title: tx("Pick_Title"),
closeLabel: tx("Pick_Close"),
dialogClass: "m01-logic__pick",
backdropClass: "m01-logic__backdrop",
mount: (body) =>
body.append(
el("div", {
className: "m01-logic__pick-bar",
children: [groupField.root, searchField.root, count],
}),
list,
),
});
const choose = (item: ElementBrief, column?: string): void => {
close();
done(item, column);
};
let seq = 0;
const load = async (): Promise<void> => {
const mine = ++seq;
try {
const found = await searchElements(select.value, search.value.trim());
if (mine !== seq) return; // 최신 응답만
count.textContent = tx("Pick_Total", { n: found.total });
const note = (item: ElementBrief): string =>
select.value === "로직"
? aliasNote(matchLogic(search.value, { ...item, 키: item.ref, 이름: item.이름 }).alias)
: "";
list.replaceChildren(...found.items.map((item) => itemRow(item, mode, choose, note(item))));
} catch (error) {
showToast(error instanceof Error ? error.message : tx("Load_Failed"), "error");
}
};
let timer = 0;
search.addEventListener("input", () => {
window.clearTimeout(timer);
timer = window.setTimeout(load, 250);
});
select.addEventListener("change", load);
search.focus();
void load();
}
function itemRow(
item: ElementBrief,
mode: PickMode,
choose: (item: ElementBrief, column?: string) => void,
note = "",
): HTMLElement {
const text = el("div", {
className: "m01-logic__stack",
children: [
el("strong", {
text: [`${item.이름 ?? ""} ${item.규격 ?? ""}`.trim(), placeNote(item)]
.filter(Boolean)
.join(" · "),
}),
el("span", {
className: "ui-text ui-text--muted",
text: [item.ref, note].filter(Boolean).join(" · "),
}),
],
});
if (mode === "table") {
const columns = Object.keys(item.값칸 ?? {});
const chips = columns.map((column) =>
createButton({ label: column, variant: "pill", onClick: () => choose(item, column) }),
);
return el("div", {
className: "m01-logic__pick-row",
children: [text, el("div", { className: "m01-logic__chips", children: chips })],
});
}
const unit = typeof item.단위 === "string" ? item.단위 : "";
const value = typeof item.값 === "object" && item.값 !== null ? "{…}" : formatNumber(item.값);
const row = el("button", {
className: "m01-logic__pick-row ui-list-row ui-sidebar-row",
attrs: { type: "button", "data-size": "32" },
children: [
text,
el("span", { className: "m01-logic__money", text: `${value} ${unit}`.trim() }),
],
});
row.addEventListener("click", () => choose(item));
return row;
}
/* ── ② 재료·기계 바꿔 고르기 ─────────────────────────────────────────────── */
export type Swaps = Map<number, ElementBrief>;
const PICKABLE = ["재료", "기계"];
/** 고를 수 있는 줄이 있는지 */
export const hasPickable = (logic: LogicRow): boolean =>
(logic.호표 ?? []).some((l) => PICKABLE.includes(l.종류));
/** 바꿔 본 줄이 있으면 고친 복사본 — 없으면 undefined(정본 그대로 셈) */
export function swappedRow(logic: LogicRow, swaps: Swaps): LogicRow | undefined {
if (!swaps.size) return undefined;
return {
...logic,
호표: (logic.호표 ?? []).map((l, i) => {
const s = swaps.get(i);
return s ? { ...l, 요소: s.ref, 이름: s.이름 ?? l.이름, 규격: s.규격 ?? l.규격 } : l;
}),
};
}
type Brief = ElementBrief & {
구분?: string;
상세구분?: string;
값들?: Record<string, unknown>;
};
const distinct = (items: Brief[], key: "구분" | "상세구분"): string[] => [
...new Set(items.map((i) => i[key]).filter((v): v is string => !!v)),
];
/** 후보 글 — 값 열이 여럿이면 있는 열을 다 보임(계산은 그 가운데 낮은 값) */
const label = (it: Brief): string => {
const cols = Object.entries(it.값들 ?? {})
.filter(([, v]) => v !== null && v !== undefined)
.map(([k, v]) => `${k} ${formatNumber(v)}`);
const prices = cols.length ? cols : [formatNumber(it.값) || tx("Mat_NoPrice")];
return [`${it.이름 ?? ""} ${it.규격 ?? ""}`.trim(), placeNote(it), ...prices]
.filter(Boolean)
.join(" · ");
};
const oldNames = (one: LogicOne, line: HoLine): string[] => {
const brief = one.prices[line.요소 as string] as { 이름?: string; 원문번호?: string } | null;
const names = [brief?.이름, brief?.원문번호, (line.이름 ?? "").split(/[\s(·]/)[0]];
return [...new Set(names.filter((n): n is string => !!n))];
};
/** 이름을 차례로 찾아 후보가 나오는 첫 결과 — 다 비면 마지막 결과 */
async function firstFound(names: string[]): Promise<Awaited<ReturnType<typeof searchPrice>>> {
let last = await searchPrice(names[0] ?? "");
for (const name of names.slice(1)) {
if (last.items.length) break;
last = await searchPrice(name);
}
return last;
}
function swapRow(one: LogicOne, line: HoLine, i: number, swaps: Swaps, onChange: () => void) {
const cond =
typeof line.요소 === "object" ? (line.요소 as unknown as Record<string, unknown>) : null;
const price = cond ? undefined : one.prices[line.요소]?.값;
let all: Brief[] = [];
let sub = "";
let detail = String(cond?.["상세구분"] ?? "");
const subBox = createSelectField({
options: [],
value: "",
compact: true,
onChange: (v) => ((sub = v), (detail = ""), fill()),
});
const detailBox = createSelectField({
options: [],
value: "",
compact: true,
onChange: (v) => ((detail = v), fill()),
});
const itemBox = createSelectField({
options: [{ value: "", text: tx("Mat_Default") }],
value: "",
onChange: (ref) => {
const item = all.find((it) => it.ref === ref);
if (item) swaps.set(i, item);
else swaps.delete(i);
onChange();
},
});
const subRow = el("div", {
className: "m01-test__filters",
children: [subBox.root, detailBox.root],
});
// 구분 → 상세구분 → 후보 — 앞 단을 고르면 뒷 단 목록이 좁혀짐(구분 칸이 없는 후보면 그 단은 숨김)
const fill = (): void => {
const subs = distinct(all, "구분");
const inSub = all.filter((it) => !sub || it.구분 === sub);
const details = distinct(inSub, "상세구분");
const inDetail = inSub.filter((it) => !detail || it.상세구분 === detail);
const all_ = { value: "", text: tx("Pick_All") };
subBox.root.hidden = subs.length < 1;
detailBox.root.hidden = details.length < 1;
subBox.setOptions([all_, ...subs.map((v) => ({ value: v, text: v }))], sub);
detailBox.setOptions([all_, ...details.map((v) => ({ value: v, text: v }))], detail);
itemBox.setOptions(
[
{ value: "", text: tx("Mat_Default") },
...inDetail.map((it) => ({ value: it.ref, text: label(it) })),
],
swaps.get(i)?.ref ?? "",
);
};
// 고르기 조건({구분, 상세구분, 규격}) 줄 = 조건 안 후보 · 옛 줄 = 이름으로 찾은 후보
const found = cond
? fetchMaterials({
sub: String(cond["구분"] ?? ""),
spec: String(cond["규격"] ?? ""),
region: "울진",
})
: line.종류 === "재료"
? firstFound(oldNames(one, line)) // 옛 줄(고르기 조건 없음) — 품셈재료 이름 → 원문번호 → 이름 첫 낱말 순으로 찾아 나온 첫 것
: searchElements(line.종류, line.이름 ?? "");
void found
.then((r) => {
all = r.items as Brief[];
if (cond) sub = String(cond["구분"] ?? "");
fill();
})
.catch(() => undefined);
const spec = line.규격 ? ` ${line.규격}` : "";
const cost =
price !== undefined && price !== null ? ` · ${tx("Mat_Price")} ${formatNumber(price)}` : "";
return el("div", {
className: "m01-test__pick",
children: [
el("strong", { text: `${line.종류} · ${line.이름 ?? String(line.요소)}${spec}` }),
el("span", { className: "ui-text ui-text--muted", text: `${line.단위 ?? ""}${cost}` }),
subRow,
itemBox.root,
],
});
}
/** 재료·기계 줄마다 한 칸씩 — 한 번 만들어 두고 다시 그릴 때 같은 노드를 씀(고른 것이 안 날아감) */
export function pickPanel(one: LogicOne, swaps: Swaps, onChange: () => void): HTMLElement {
const rows = (one.logic.호표 ?? [])
.map((line, i) => ({ line, i }))
.filter((x) => PICKABLE.includes(x.line.종류))
.map((x) => swapRow(one, x.line, x.i, swaps, onChange));
return el("div", {
className: "m01-test__picks",
children: rows.length ? rows : [el("p", { text: tx("Mat_None") })],
});
}
@@ -9,10 +9,6 @@ const TEXT = {
Title: ["단가산출 기초", "Unit-price logic"],
List_Search: ["이름 · 별칭 찾기", "Search name or alias"],
List_Alias: ["별칭 — 쉼표로 여럿 · 고친 뒤 [저장]", "Aliases — comma separated · then [Save]"],
List_AllBooks: ["원문 모두", "All sources"],
List_AllChapters: ["장 모두", "All chapters"],
List_BlockedOnly: ["막힘만", "Blocked only"],
List_Count: ["{n} 개", "{n} items"],
List_Blocked: ["막힘", "Blocked"],
List_Edited: ["고침", "Edited"],
List_New: ["새것", "New"],
@@ -39,33 +35,11 @@ const TEXT = {
Head_Owner: ["소유", "Owner"],
Head_Note: ["비고", "Note"],
Head_Blocked: ["막힌 까닭", "Why blocked"],
Inputs_Title: ["설계에서 받을 값", "Values from design"],
Inputs_Unit: ["단위", "Unit"],
Inputs_Choices: ["고르기(쉼표로)", "Choices (comma)"],
Inputs_Range: ["범위", "Range"],
Ho_Title: ["호표", "Unit-cost lines"],
Ho_Kind: ["종류", "Kind"],
Ho_Element: ["요소", "Element"],
Ho_Name: ["이름·규격", "Name · spec"],
Ho_Unit: ["단위", "Unit"],
Ho_Qty: ["수량", "Qty"],
Ho_Price: ["단가", "Unit price"],
Ho_Amount: ["금액", "Amount"],
Ho_Cost: ["비목", "Cost item"],
Ho_Pick: ["찾기", "Find"],
Ho_PickTable: ["표", "Table"],
Ho_QtyNumber: ["수", "Number"],
Ho_QtyTable: ["표 찾기", "Table lookup"],
Ho_QtyFormula: ["식", "Formula"],
Ho_PriceLater: ["계산 때", "At calc"],
Ho_Missing: ["없는 요소", "Missing element"],
Middle_Title: ["중간 값", "Intermediate values"],
Result_Title: ["결과 식(돈 아닌 로직)", "Result formula (non-money)"],
Extra_Title: ["덧줄", "Extra lines"],
Rounding: ["끝수", "Rounding"],
Formula: ["식", "Formula"],
AddRow: ["줄 추가", "Add line"],
DeleteRow: ["줄 삭제", "Delete line"],
Calc_Title: ["시험 계산", "Test calculation"],
Calc_Run: ["계산", "Calculate"],
Calc_NoInputs: ["받을 값 없음", "No inputs"],
@@ -75,20 +49,11 @@ const TEXT = {
Calc_Sum: ["계", "Total"],
Pick_Title: ["요소 찾기", "Find element"],
Pick_Search: ["이름·키·원문번호", "Name · key · source no."],
Pick_Total: ["{n} 개 중 앞 100 개", "first 100 of {n}"],
Pick_Item: ["품목 고르기", "Pick item"],
Pick_Machine: ["기계 고르기", "Pick machine"],
Pick_MatTitle: ["자재품목 고르기", "Pick a material item"],
Pick_Chosen: ["고름", "Picked"],
Calc_UnitWarn: ["단위 다름", "Unit differs"],
Pick_Close: ["닫기", "Close"],
Pick_All: ["(전체)", "(All)"],
Mat_Title: ["쓰이는 재료·기계", "Materials and machines"],
Mat_None: ["이 공종은 재료·기계를 따로 고르지 않습니다", "No materials or machines to pick"],
Mat_Default: ["기본 (원문 그대로)", "Default (as in source)"],
Mat_Price: ["단가", "Unit price"],
Mat_NoPrice: ["단가 없음", "No price"],
Enter_Value: ["값을 넣어 주세요", "Enter a value"],
Save_Done: ["저장했음", "Saved"],
Save_Stale: [
"그 사이 파일이 바뀜 — 고친 것을 버리고 다시 여세요: {v}",
@@ -110,39 +75,6 @@ const TEXT = {
"저장 안 한 고친 것(기본정보 · 수식)을 버리고 저장 뒤 상태로 되돌릴까요?",
"Discard unsaved edits (info · formula) and revert to the saved state?",
],
Confirm_Leave: [
"저장 안 한 로직이 있음 — 다른 로직을 열어도 고친 것은 남음",
"Unsaved logics stay in the draft",
],
New_Key: ["새 로직", "New logic"],
/* ── 흐름 그림(기본 보기) ── */
Flow_NoInputs: ["받을 값 없음", "No inputs"],
Flow_Other: ["그 밖", "Other"],
Flow_Sub: ["이 로직이 부르는 로직", "Logic called here"],
Flow_SubLines: ["호표", "Unit-cost lines"],
Col_입력: ["설계 값", "Design values"],
Col_중간: ["표 찾기", "Table lookup"],
Col_수량: ["수량", "Qty"],
Col_단가: ["× 단가", "× Unit price"],
Col_덧줄: ["할증·덧줄", "Extra lines"],
Col_비목: ["비목 합계", "Cost items"],
Col_계: ["계", "Total"],
/* ── 상자 속 설명 카드 ── */
Note_Plain: ["쉬운 말 풀이", "In plain words"],
Note_Table: ["원문 표 미리보기", "Source table"],
Note_TableMissing: ["{v} 표 못 찾음", "Table {v} not found"],
Note_Searching: ["찾는 중", "Looking up"],
Note_Formula: ["고급 — 식 그대로", "Advanced — raw formula"],
Note_ThisLine: ["이 줄", "This line"],
Use_Of: ["이 표의 용도", "Used for"],
/* ── 상자에서 고치기 ── */
Edit_On: ["고치기", "Edit"],
Edit_Off: ["고치기 끝", "Done"],
Edit_AddHo: ["호표 줄 추가", "Add unit-cost line"],
Edit_AddInput: ["설계 값 추가", "Add design value"],
Edit_AddMiddle: ["표 찾기 추가", "Add table lookup"],
Edit_AddExtra: ["덧줄 추가", "Add extra line"],
Edit_Qty: ["수량 식", "Qty formula"],
/* ── 멈춘 까닭을 설계자 말로 ── */
Stop_Missing: [
"「{name}」 값을 아직 안 넣었습니다 — 값을 넣으면 계산됩니다",
@@ -186,8 +118,6 @@ export function safeReason(reason: string): string {
return /[{}"']|Decimal\(/.test(plain) ? tx("Stop_Generic") : plain;
}
/** 흐름 그림 머리 「이렇게 씀」 — 줄 목록 */
/** 공용 `t()` 와 같은 뜻 — `{n}`·`{v}` 는 채움 */
export function tx(key: TextKey, fill: Record<string, string | number> = {}): string {
const entry = TEXT[key];
+1 -1
View File
@@ -18,7 +18,7 @@ import {
import { ALIAS_TITLE, buildAliasBoard, type AliasRow } from "./M01_MasterData_UI_Alias";
import { fetchFiles, fetchSubsAll, type FileInfo, type SubInfo } from "./M01_MasterData_Api_Fetch";
import { tx } from "./M01_MasterData_UI_Logic_Text";
import { renderTree, type MakeRow } from "./M01_MasterData_UI_Tree";
import { renderTree, type MakeRow } from "@ui/ui_template_tree";
/** 컨테이너마다 기억하는 화면 상태 — 찾기 글 · 쪽 · 소요량·계수 표의 용도 대상 거름 (거름은 `m01.filter.*`) */
export interface View {
-6
View File
@@ -1,6 +0,0 @@
/* =============================================================================
* M01_MasterData_UI_Tree.ts
* 왼쪽 패널 트리 — 공용 `ui_template_tree` 를 그대로 다시 내보냄(부르는 쪽 import 불변)
* ========================================================================== */
export { renderTree, type MakeRow, type TreeNode } from "@ui/ui_template_tree";
@@ -5,7 +5,7 @@ const { makeLoader } = require("./helper_ts_stub_loader.cjs");
const ROOT = path.join(__dirname, "..", "..");
const { load } = makeLoader({
root: ROOT,
stubs: { M01_MasterData_UI_Logic_Edit: {}, M01_MasterData_UI_Logic_Text: {} },
stubs: { M01_MasterData_UI_Logic_Text: {} },
});
const urls = [];
global.fetch = async (url) => {
@@ -170,7 +170,6 @@ def test_M01_목록_별칭_열은_이름_옆_고치면_캐시() -> None:
"rel",
[
"M01_MasterData/M01_MasterData_UI_Logic_List.ts", # M01 로직 목록
"M01_MasterData/M01_MasterData_UI_Logic_Pick.ts", # M01 요소 찾기 창 · 로직 그룹
"M02_MasterTemplete/M02_MasterTemplete_Labor_Pick.ts", # M02 · B09 [로직 더하기]
],
)
+1 -8
View File
@@ -1,4 +1,4 @@
"""782-1 작은 흠 둘 — 소스 지킴: 끝내기 확인창 인자 자리 · 로직 편집 소유 선택지."""
"""782-1 작은 흠 — 소스 지킴: 끝내기 확인창 인자 자리."""
from pathlib import Path
@@ -12,10 +12,3 @@ def test_finish_confirm_args_in_order():
assert block.rstrip().endswith('"끝내기",') or '"끝내기"' in block.splitlines()[-1]
assert "M02_SkUnmoved" in block.split('"끝내기"')[0]
assert block.count('"끝내기"') == 1 and '""' not in block.split("// 780-2")[-1]
def test_owner_choices_match_server():
ui = (ROOT / "M01_MasterData/M01_MasterData_UI_Logic_Edit.ts").read_text("utf-8")
py = (ROOT / "M01_MasterData/M01_MasterData_Store_Make.py").read_text("utf-8")
assert 'OWNERS = ("현장", "공용")' in py
assert 'choice(["현장", "공용"]' in ui
@@ -45,7 +45,6 @@ def test_따로_둔_모달도_위_고정():
)
for rel in (
"M01_MasterData/M01_MasterData_UI_Pick.ts",
"M01_MasterData/M01_MasterData_UI_Logic_Pick.ts",
"M01_MasterData/M01_MasterData_UI_Logic_PickTable.ts",
"M01_MasterData/M01_MasterData_UI_LogicLab_Copy.ts",
):