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:
@@ -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,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user