Files
Aislo/ui_template/ui_template_calc_row.ts
T
eomsangdonandClaude Opus 5.5 271c460641 fix(부품·테마): 위험 채움 대비 4.72 · 남은 옛 꼴 → 부품(계산 줄 · 칸 램프 · 넓은 중간 창 · 규칙 꼴 · 구역 머리 · 입력 칸 2열) (PLAN 557-2)
- 위험 채움 토큰 밝음 #e5484d → #d6363c(흰 글 3.91 → 4.72) · 어두움 5.6 · 위험 글 #c0392b 그대로
- 새 부품 계산 줄(ui_template_calc_row) — B08 수리집수면적표 b08-hydro__row · 식 칸 배치를 대신함
- 표 부품 칸 램프(ui-data-table__lamp · --only · ✓) — B08 집계표 · 거리이정표 · B09 설계내역 램프 CSS 세 벌을 걷음(표지 class 는 풍선 · 가이드용으로 남김)
- 모달 넓은 중간 창(wide + width 1100px · 1100 × 680) — B09 운반 창 손 인라인 크기를 걷음
- 값 목록 규칙 꼴(rule) — ☰ 설정 규칙 줄 ul/li 를 걷음
- 접이 구역 머리(createCollapsibleHead = 패널 머리 + 접는 제목) — B08 구조물도 「조합 연결」 제목(옛 b08-sheets__title)을 대신함
- 일반 화면 틀 좁은 폭 · 입력 칸 2열 · 끝 단추 줄 — D01 · E01 이 B02 CSS 를 빌리던 것을 끊음(가이드 장면 선택자 맞춤)
- 부품 모음 견본 · 지킴 시험 test_557_2 · 낡은 시험(198_1 · 247_1 · 251_1 · 257_1 · 276_1 · 551_1)은 부품 CSS · 새 class 로 맞춤

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 10:53:34 +09:00

66 lines
3.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* =============================================================================
* ui_template_calc_row.ts
* 부품 「계산 줄」(557-2) — 계산서 한 줄: 이름 · 값 칸(입력 또는 계산 결과) · 덧칸(식 · 안내 · 둘째 값).
* 꼴 = 값 줄(`createCalcRow` · 이름 | 값 112 | 덧칸) · 식 줄(`createCalcFormulaRow` · 이름 | 식 | 값 112)
* · 식 글(`createCalcFormula` · `^…^` 위첨자 · `_…_` 아래첨자) · 이름 칸 안 고르기(`ui-calc-row__label--select`)
* · 칸 조각 클래스 = 입력 `ui-calc-row__in` · 고르기 `__select`(값 칸 + 덧칸) · 결과 글 `__out`(숫자 오른쪽 · 중요 `is-key` 굵게) · 글 값 `__value` · 안내 `__hint`
* 크기 = 줄 최소 30(작은 입력) · 값 칸 112 · 사이 8 · 이름 14 · 식 · 안내 12
* 상태 = 기본만(입력 · 고르기 부품이 저마다 상태를 가짐 · 판정 색은 화면이 `is-key` 에 줌)
* 쓰는 법 = `createCalcRow("f : 유출계수", input)` · `createCalcFormulaRow("유속 (m/s)", createCalcFormula("V = 1/n × R^2/3^"), out)`
* 대신하는 옛 변종 = B08 수리집수면적표 `b08-hydro__row(--f)` · `__label` · `__formula` · `__out` · `__value` · `__in` · `__hint` · `__select`
* ========================================================================== */
import "./ui_template_calc_row.css";
function span(className: string, text = ""): HTMLElement {
const el = document.createElement("span");
el.className = className;
el.textContent = text;
return el;
}
/** 식 글 — `^…^` 사이는 위첨자 · `_…_` 사이는 아래첨자 · className 을 주면 이름 칸 등으로 씀 */
export function createCalcFormula(text: string, className = "ui-calc-formula"): HTMLElement {
const box = document.createElement("div");
box.className = className;
for (const part of text.split(/(\^[^^]+\^|_[^_]+_)/)) {
const tag =
part.startsWith("^") && part.endsWith("^")
? "sup"
: part.startsWith("_") && part.endsWith("_")
? "sub"
: "";
if (tag) {
const el = document.createElement(tag);
el.textContent = part.slice(1, -1);
box.append(el);
} else if (part) box.append(part);
}
return box;
}
/** 값 줄 — 이름 · 값 칸(입력 또는 계산) · 덧칸 */
export function createCalcRow(
label: string | HTMLElement,
value: HTMLElement,
extra?: HTMLElement,
): HTMLElement {
const row = document.createElement("div");
row.className = "ui-calc-row";
row.append(typeof label === "string" ? span("ui-calc-row__label", label) : label, value);
if (extra) row.append(extra);
return row;
}
/** 식 줄 — 이름 · 식(없으면 빈 칸) · 값 칸 */
export function createCalcFormulaRow(
label: string,
middle: HTMLElement | null,
value: HTMLElement,
): HTMLElement {
const row = document.createElement("div");
row.className = "ui-calc-row ui-calc-row--formula";
row.append(span("ui-calc-row__label", label), middle ?? document.createElement("span"), value);
return row;
}