feat(M01): 화면 부품 공용화 — 드롭다운·찾기 칸·단추·확인창을 공용 템플릿으로 · 재료 컨테이너 차례
- createSelectField 에 선택 인자 더함(compact · ariaLabel · setOptions) — 기본 동작 그대로 - 인력 2단 거름 · 로직 편집 고르기 · 계산 입력 · 요소 찾기 창 그룹 select 를 공용으로 · m01-side__select 걷음 - 찾기 칸은 createInputField · 표 칸·모달 단추는 createButton · 버리기 확인은 showConfirmDialog - 재료 컨테이너 = 자재품목 · 유가 · 품셈재료 차례 · 안 쓰는 조달 문구 걷음 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WRFJmmhPi4exAzHgPZHMT
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* 줄 더하기·지우기 · 요소 고르기처럼 모양이 바뀔 때만 `rerender`.
|
||||
* ========================================================================== */
|
||||
|
||||
import { createButton, el } from "@ui/ui_template_elements";
|
||||
import { createButton, createSelectField, el } from "@ui/ui_template_elements";
|
||||
import type {
|
||||
CalcLine,
|
||||
ElementBrief,
|
||||
@@ -70,14 +70,14 @@ function choice(
|
||||
options: string[],
|
||||
value: string | undefined,
|
||||
onPick: (v: string) => void,
|
||||
): HTMLSelectElement {
|
||||
const select = el("select", { className: "m01-logic__input" });
|
||||
for (const option of value && !options.includes(value) ? [value, ...options] : options) {
|
||||
select.append(el("option", { text: option, attrs: { value: option } }));
|
||||
}
|
||||
select.value = value ?? options[0];
|
||||
select.addEventListener("change", () => onPick(select.value));
|
||||
return select;
|
||||
): 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 {
|
||||
|
||||
Reference in New Issue
Block a user