feat(804-9): 표준 단위 21 더함 · 표 값 직접 침 별칭 유지 · 공식 묶음 여러 열(요구 692-1 · 3)
- 단위표준.json 「더한 단위」 21(수식 문서 항목 줄 단위 · 표에 없던 것) · 「같은 단위」 kg → ㎏ · cm → ㎝(801-5 원문 꼴 하나만) · 산림품셈 원문 줄은 그대로 - 단위 고르기 = 표 줄 + 더한 단위 · 같은 단위는 원문 꼴로 모음 · 문서 항목 줄 단위 5,912 전수가 표에 있음 - 표 값 칸에 숫자 · 식을 치면 표 · 칸 · 조건을 남김 → 화면 이름(804-5 별칭) 그대로 · 꼬리표 「직접 입력」 · 서버 셈 = 표 정보 없는 숫자와 같음 - 공식 묶음 = 폭만큼 여러 열(auto-fill 19rem · M01 1366 · 1920 = 2열 · 좁으면 1열) · 머리 · 식 글 · 고치는 줄 = 열 합침 · 긴 이름 · 표 단추 · 꼬리표 = 줄임표 + 마우스 글 - 부품 상자 단추 clip 꼴 더함(긴 글 줄임 · title 전체) - test_804_7 셋 더함 · helper 「직접」 할일 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -162,14 +162,55 @@
|
||||
background: var(--color-surface-raised);
|
||||
}
|
||||
|
||||
/* 공식 묶음 = 폭만큼 여러 열(요구 692-3 · 자동 채움) · 머리 · 식 글 줄 · 고치는 줄 = 열 합침 · 긴 이름 = 줄임표 */
|
||||
.lstk-line.k-공식 {
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
align-items: stretch;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
|
||||
align-items: center;
|
||||
column-gap: var(--spacing-16);
|
||||
position: relative;
|
||||
padding-inline-start: var(--spacing-24);
|
||||
}
|
||||
|
||||
.lstk-line.k-공식 > .lstk-fhead,
|
||||
.lstk-line.k-공식 > .lstk-frow:is(.is-open, :has(> .lstk-expr)) {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.lstk-line.k-공식 > .lstk-frow:not(.is-open, :has(> .lstk-expr)) {
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
.lstk-line.k-공식 > .lstk-frow:not(.is-open) > .lstk-f-m {
|
||||
width: 6em;
|
||||
}
|
||||
|
||||
.lstk-frow > .lstk-sym {
|
||||
flex: none;
|
||||
max-width: 50%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.lstk-frow > .lstk-f-m,
|
||||
.lstk-frow > .lstk-unit,
|
||||
.lstk-rtools {
|
||||
flex: none;
|
||||
}
|
||||
|
||||
.lstk-rtools {
|
||||
display: inline-flex;
|
||||
gap: var(--spacing-4);
|
||||
}
|
||||
|
||||
.lstk-frow > .lstk-tag {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.lstk-line > .lstk-x,
|
||||
.lstk-fhead > .lstk-x {
|
||||
margin-inline-start: auto;
|
||||
|
||||
@@ -56,6 +56,10 @@ const LINK_TAG: Record<string, string> = {
|
||||
입력: "입력",
|
||||
};
|
||||
|
||||
/** 출처 꼬리표 — 긴 글은 칸 안에서 줄임표 · 마우스 글에 전체(요구 692-3) */
|
||||
const clipTag = (text: string): HTMLElement =>
|
||||
el("span", { className: "lstk-tag", text, attrs: { title: text } });
|
||||
|
||||
const input = (
|
||||
value: string,
|
||||
placeholder: string,
|
||||
@@ -107,7 +111,7 @@ export function buildBlock(
|
||||
const tplName = (k: string): string =>
|
||||
k.startsWith("my:") ? lt("My_Tpl") : (h.subDoc(k)?.이름 ?? (h.name(k) || k)); // my: = 옛 내 틀(걷음 · 요구 685)
|
||||
const changed = !!line.틀 && !!line.틀꼴 && shapeOf(d, line.기호) !== line.틀꼴;
|
||||
const tableOnly = line.기호.every((id) => vars.get(id)?.연결?.갈래 === "표" && !lines.has(id));
|
||||
const tableOnly = line.기호.every((id) => !!vars.get(id)?.연결?.표 && !lines.has(id)); // 직접 친 표 값도
|
||||
const label = !line.틀
|
||||
? lt(tableOnly && line.기호.length ? "K_표값" : "K_공식")
|
||||
: changed
|
||||
@@ -148,6 +152,7 @@ export function buildBlock(
|
||||
.join(" · ") + " ▾", // 고른 줄(글 조건) · 칸
|
||||
variant: "ghost",
|
||||
size: 24,
|
||||
clip: true, // 긴 줄 이름 = 칸 안에서 줄임(요구 692-3)
|
||||
onClick: () =>
|
||||
void h.table(String(link.표 ?? "")).then((t) => {
|
||||
if (!t) return void showToast(lt("Tbl_Missing"), "warning");
|
||||
@@ -161,7 +166,7 @@ export function buildBlock(
|
||||
}),
|
||||
});
|
||||
b.dataset.tablePick = id;
|
||||
b.title = h.name(String(link.표 ?? "")) || String(link.표 ?? "");
|
||||
b.title = `${b.title} — ${h.name(String(link.표 ?? "")) || String(link.표 ?? "")}`;
|
||||
return b;
|
||||
};
|
||||
|
||||
@@ -221,12 +226,17 @@ export function buildBlock(
|
||||
const tag =
|
||||
link?.갈래 === "표" && !expr
|
||||
? tableBtn(id, link)
|
||||
: link && LINK_TAG[link.갈래 ?? ""] && !expr
|
||||
: link?.갈래 === "숫자" && link.표 && !expr
|
||||
? el("span", {
|
||||
className: "lstk-tag",
|
||||
text: `${LINK_TAG[link.갈래!]}${link.키 && !link.키.includes("{") ? ` · ${sub?.이름 ?? h.name(link.키) ?? ""}` : ""}`,
|
||||
text: lt("Direct"),
|
||||
attrs: { title: lt("Direct_Hint") },
|
||||
})
|
||||
: null;
|
||||
: link && LINK_TAG[link.갈래 ?? ""] && !expr
|
||||
? clipTag(
|
||||
`${LINK_TAG[link.갈래!]}${link.키 && !link.키.includes("{") ? ` · ${sub?.이름 ?? h.name(link.키) ?? ""}` : ""}`,
|
||||
)
|
||||
: null;
|
||||
const tools: HTMLElement[] = [];
|
||||
if (sub?.결과 && link?.키)
|
||||
tools.push(
|
||||
@@ -259,6 +269,7 @@ export function buildBlock(
|
||||
}),
|
||||
);
|
||||
const name = tap(el("b", { className: "lstk-sym", text: show(id) }), id);
|
||||
name.title = `${show(id)} — ${name.title}`; // 줄임표로 잘려도 전체 이름
|
||||
const valueOf =
|
||||
expr ??
|
||||
(link?.갈래 === "숫자" ? String(link.값 ?? "") : isNum(vals[id]) ? String(vals[id]) : "");
|
||||
@@ -318,7 +329,11 @@ export function buildBlock(
|
||||
];
|
||||
const row = el("div", {
|
||||
className: `lstk-frow ${open ? "is-open" : ""}`,
|
||||
children: [...body, ...(tag ? [tag] : []), ...tools],
|
||||
children: [
|
||||
...body,
|
||||
...(tag ? [tag] : []),
|
||||
...(tools.length ? [el("span", { className: "lstk-rtools", children: tools })] : []),
|
||||
],
|
||||
});
|
||||
row.dataset.sym = id;
|
||||
return row;
|
||||
|
||||
@@ -65,6 +65,8 @@ const TEXT = {
|
||||
Repick: ["찾아 바꾸기", "Find and change"],
|
||||
Close: ["닫기", "Close"],
|
||||
Tbl: ["표", "Table"],
|
||||
Direct: ["직접 입력", "Typed"],
|
||||
Direct_Hint: ["표 값을 손으로 고침 — 표 연결 끊김", "Table value typed by hand — table link off"],
|
||||
Tbl_Missing: ["표를 못 읽음", "Table not found"],
|
||||
Tbl_Hint: ["값 칸을 누르면 그 값이 들어감", "Click a value cell to use it"],
|
||||
Tbl_Bound: [
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =============================================================================
|
||||
* M02_DF_UnitPick.ts
|
||||
* 단가산출 흐름도 공용 단위 고르기 — 치면 걸러진 목록 · 고르기만(손글 안 받음 · `free` = 목록에 없는 친 글도 씀) · 「-」 = 없음
|
||||
* 목록 = 단위 표준(산림품셈 1-2-2) 단위 + 부른 쪽이 주는 마스터 결과단위 등 + 원
|
||||
* 목록 = 단위 표준(산림품셈 1-2-2) 단위 + 표의 「더한 단위」(수식 문서 줄 단위) + 부른 쪽이 주는 마스터 결과단위 등 + 원 · 「같은 단위」(kg → ㎏) 는 하나만
|
||||
* 표준 표 읽는 길은 `setUnitSource` 로 바꿔 끼움(기본 = 서버 /standards) — 다른 판도 이것을 씀
|
||||
* 글 [한, 영] 짝은 아래 TEXT
|
||||
* ========================================================================== */
|
||||
@@ -43,13 +43,22 @@ interface StandardRow {
|
||||
|
||||
/** 서버 표준 표(/standards) — 고친 표가 있으면 그것, 없으면 처음 값 */
|
||||
const fromServer: UnitSource = async () => {
|
||||
const table = (await cfStandards()).unit as { 줄: StandardRow[] };
|
||||
const units = table.줄
|
||||
.flatMap((r) => [r["규격 단위"], r["단위수량 단위"]])
|
||||
const table = (await cfStandards()).unit as {
|
||||
줄: StandardRow[];
|
||||
"더한 단위"?: string[];
|
||||
"같은 단위"?: Record<string, string>;
|
||||
};
|
||||
const same = (u: string | null | undefined): string | null | undefined =>
|
||||
(u && table["같은 단위"]?.[u]) || u; // kg → ㎏ 등 원문 꼴 하나만(요구 692)
|
||||
const units = [
|
||||
...table.줄.flatMap((r) => [r["규격 단위"], r["단위수량 단위"]]),
|
||||
...(table["더한 단위"] ?? []),
|
||||
]
|
||||
.map(same)
|
||||
.filter((u): u is string => !!u);
|
||||
const count: Record<string, Record<number, number>> = {};
|
||||
for (const r of table.줄) {
|
||||
const u = r["단위수량 단위"];
|
||||
const u = same(r["단위수량 단위"]);
|
||||
const p = r["단위수량 소수자리"];
|
||||
if (!u || u === "없음" || typeof p !== "number") continue;
|
||||
count[u] = { ...count[u], [p]: (count[u]?.[p] ?? 0) + 1 };
|
||||
|
||||
@@ -676,5 +676,33 @@
|
||||
"① 설계서 수량의 단위와 소수자리 표시는 본 표에 따르며, 반올림하여 적용한다.",
|
||||
"② 품셈 각 항목에서 제시한 소숫자리가 본 표의 내용과 상이할 경우 항목에서 제시하는 소숫자리를 우선하여 적용한다.",
|
||||
"③ 본 표에 제시하지 않은 품의 경우 유사품의 규격과 단위수량을 참고하여 적용하며, C.G.S 단위로 하는 것을 원칙으로 한다."
|
||||
]
|
||||
],
|
||||
"더한 단위": [
|
||||
"시간",
|
||||
"식",
|
||||
"㎏",
|
||||
"L",
|
||||
"본",
|
||||
"㎾h",
|
||||
"조",
|
||||
"EA",
|
||||
"대",
|
||||
"Sh",
|
||||
"g",
|
||||
"동",
|
||||
"통",
|
||||
"병",
|
||||
"㎝",
|
||||
"D/M",
|
||||
"연",
|
||||
"SET",
|
||||
"회",
|
||||
"포",
|
||||
"족"
|
||||
],
|
||||
"같은 단위": {
|
||||
"kg": "㎏",
|
||||
"cm": "㎝"
|
||||
},
|
||||
"더함": "「더한 단위」 = 표에 없는 수식 문서 항목 줄 단위(요구 692) · 「같은 단위」 = 원문 꼴(건설품셈 1-2-2 · ㎏ · ㎝)로 하나만 보임"
|
||||
}
|
||||
|
||||
@@ -337,14 +337,15 @@ export function setRow(doc: FormulaDoc, id: string, text: string): void {
|
||||
const n = nodeOf(t);
|
||||
const plain = n && (n[0] === "num" || (n[0] === "neg" && n[1][0] === "num"));
|
||||
let v = (doc.변수 ?? []).find((x) => varId(x) === id);
|
||||
const from = v?.연결?.표 ? { 표: v.연결.표, 칸: v.연결.칸, 조건: v.연결.조건 } : {}; // 표에서 온 기호 = 별칭 · 꼬리표 남김(요구 692)
|
||||
if (plain || !t) {
|
||||
doc.식 = (doc.식 ?? []).filter((l) => l.기호 !== id);
|
||||
if (!v) (doc.변수 ??= []).push((v = newVar(id, { 갈래: "숫자" })));
|
||||
const value = t ? Number(t) : null;
|
||||
v.연결 = { 갈래: "숫자", 값: Number.isFinite(value) ? value : t };
|
||||
v.연결 = { ...from, 갈래: "숫자", 값: Number.isFinite(value) ? value : t };
|
||||
return;
|
||||
}
|
||||
if (v && v.연결?.갈래 !== "식") v.연결 = { 갈래: "식" };
|
||||
if (v && v.연결?.갈래 !== "식") v.연결 = { ...from, 갈래: "식" };
|
||||
const line = (doc.식 ?? []).find((l) => l.기호 === id);
|
||||
if (line) line.식 = text.trim();
|
||||
else (doc.식 ??= []).push({ 기호: id, 식: text.trim() });
|
||||
|
||||
@@ -155,7 +155,8 @@ export function stackLevels(items: StackItem[]): { item: number; line: number }[
|
||||
}
|
||||
|
||||
/** 표 값 기호 화면 이름(804-5 · 요구 683) — 「Q_수량2^표」 → 「Q_작업반장」(고른 줄 글 조건 첫 낱말) · 글 조건 없으면 「^표」만 뗌
|
||||
* · 「^표」 기호만 · 겹치면 2 · 3 · 문서 기호는 그대로(화면만 · 칸 글은 `aliasText` 로 오감) */
|
||||
* · 「^표」 기호만 · 겹치면 2 · 3 · 문서 기호는 그대로(화면만 · 칸 글은 `aliasText` 로 오감)
|
||||
* · 직접 친 값(숫자 · 식)도 표 · 칸 · 조건을 남기므로 같은 이름(요구 692) */
|
||||
export function tableAlias(doc: FormulaDoc): Record<string, string> {
|
||||
const taken = new Set([
|
||||
...symbols(doc),
|
||||
@@ -167,7 +168,7 @@ export function tableAlias(doc: FormulaDoc): Record<string, string> {
|
||||
const out: Record<string, string> = {};
|
||||
for (const v of doc.변수 ?? []) {
|
||||
const link = v.연결;
|
||||
if (link?.갈래 !== "표") continue;
|
||||
if (!link?.표) continue;
|
||||
const id = varId(v);
|
||||
const [s, lo, up] = splitId(id);
|
||||
const said = Object.values(link.조건 ?? {})
|
||||
|
||||
@@ -239,6 +239,20 @@ function aliasOf({ 문서 }) {
|
||||
return { 별칭: alias, 틀림: bad };
|
||||
}
|
||||
|
||||
/* 692-1 표 값 직접 침 — 숫자 두 번 · 식 한 번 쳐도 별칭 같음 · 고친 문서(서버 셈 대조) */
|
||||
function directOf({ 문서 }) {
|
||||
const before = pk2.tableAlias(문서);
|
||||
const doc = JSON.parse(JSON.stringify(문서));
|
||||
const ids = Object.keys(before);
|
||||
for (const id of ids) ls.setRow(doc, id, "7");
|
||||
for (const id of ids) ls.setRow(doc, id, "8");
|
||||
const typed = pk2.tableAlias(doc);
|
||||
const expr = JSON.parse(JSON.stringify(doc));
|
||||
for (const id of ids) ls.setRow(expr, id, "8 + 0");
|
||||
const kinds = ids.map((id) => varOf(doc, id).연결.갈래);
|
||||
return { 전: before, 숫자: typed, 식: pk2.tableAlias(expr), 갈래: kinds, 문서: doc };
|
||||
}
|
||||
|
||||
const input = JSON.parse(fs.readFileSync(0, "utf8"));
|
||||
const job = {
|
||||
왕복: roundTrip,
|
||||
@@ -251,5 +265,6 @@ const job = {
|
||||
옮김: moveAll,
|
||||
번지: placeOf,
|
||||
별칭: aliasOf,
|
||||
직접: directOf,
|
||||
}[input.할일];
|
||||
process.stdout.write(JSON.stringify(input.문서들.map(job)));
|
||||
|
||||
@@ -238,3 +238,88 @@ def test_M02_수식탭_M01과_같은_단추_저장_한_번() -> None:
|
||||
assert f"iconStart: {i}" in lab, i
|
||||
css = _src("ui_template/ui_template_button.css")
|
||||
assert ".ui-btn-row--tight .ui-btn:has(> .ui-btn__icon) > .ui-btn__label" in css
|
||||
|
||||
|
||||
def test_단위표_더한_단위_문서_전수() -> None:
|
||||
"""804-9(요구 692-1) — 표준 단위 표 「더한 단위」 21 · kg ↔ ㎏ · cm ↔ ㎝ 하나만 · 수식 문서 항목 줄 단위 전부 표에 있음."""
|
||||
from M02_MasterTemplete.DataFlow import M02_DF_Router as df
|
||||
|
||||
table = df.get_standards()["unit"]
|
||||
same = table["같은 단위"]
|
||||
assert same == {"kg": "㎏", "cm": "㎝"}
|
||||
added = table["더한 단위"]
|
||||
assert len(added) == len(set(added)) == 21
|
||||
units = {
|
||||
same.get(u, u) for r in table["줄"] for u in (r["규격 단위"], r["단위수량 단위"]) if u
|
||||
} | {same.get(u, u) for u in added}
|
||||
assert "kg" not in units and "cm" not in units and {"㎏", "㎝"} <= units
|
||||
|
||||
lines: list[str] = []
|
||||
|
||||
def walk(o) -> None:
|
||||
if isinstance(o, dict):
|
||||
if "비목" in o and "단위" in o:
|
||||
lines.append(str(o["단위"] or ""))
|
||||
for v in o.values():
|
||||
walk(v)
|
||||
elif isinstance(o, list):
|
||||
for v in o:
|
||||
walk(v)
|
||||
|
||||
for f in (ROOT / "resources/master_data/수식문서").glob("*.json"):
|
||||
walk(json.loads(f.read_text(encoding="utf-8")))
|
||||
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")
|
||||
assert (
|
||||
'...(table["더한 단위"] ?? []),' in pick and '(u && table["같은 단위"]?.[u]) || u' in pick
|
||||
)
|
||||
|
||||
|
||||
def test_표값_직접_침_별칭_그대로() -> None:
|
||||
"""804-9(요구 692-1) — 표 값 칸에 숫자 · 식을 쳐도 화면 이름(별칭) 그대로 · 꼬리표 「직접 입력」 · 서버 셈 = 표 정보 없는 숫자와 같음."""
|
||||
from M02_MasterTemplete import M02_Doc_Copy as dc
|
||||
from resources.tester.test_804_2_line_stack import _ts, mr
|
||||
|
||||
docs = dc.folder()
|
||||
keys = sorted(
|
||||
k for k, d in docs.items() if any((v.get("위") == "표") for v in d.get("변수") or [])
|
||||
)
|
||||
got = dict(zip(keys, _ts("직접", [{"문서": docs[k]} for k in keys])))
|
||||
named = 0
|
||||
for k, g in got.items():
|
||||
assert g["전"] == g["숫자"] == g["식"], k
|
||||
assert set(g["갈래"]) <= {"숫자"}, k
|
||||
named += len(g["전"])
|
||||
assert named > 500
|
||||
links = dc.ml.Links(dc.skc.whole_(), docs)
|
||||
calc = lambda d: dc.mc.calc(d, (r := mr.Rec(links), r.prefetch(d))[0]) # noqa: E731
|
||||
docs_sum = {k: calc(docs[k]).get("계") for k in ("GF000099", "GF000226", "GC000211")}
|
||||
for k in ("GF000099", "GF000226", "GC000211"):
|
||||
typed = got[k]["문서"]
|
||||
plain = json.loads(json.dumps(typed))
|
||||
for v in plain["변수"]:
|
||||
link = v.get("연결") or {}
|
||||
if link.get("갈래") == "숫자":
|
||||
v["연결"] = {"갈래": "숫자", "값": link.get("값")}
|
||||
a, b = calc(typed), calc(plain)
|
||||
assert [a.get(c) for c in ("노무비", "재료비", "경비", "계")] == [
|
||||
b.get(c) for c in ("노무비", "재료비", "경비", "계")
|
||||
], k
|
||||
assert a.get("계") and a.get("계") != docs_sum.get(k), (k, a.get("계"))
|
||||
rows = _src("A00_Common/line_stack_rows.ts")
|
||||
assert 'link?.갈래 === "숫자" && link.표 && !expr' in rows
|
||||
assert "const from = v?.연결?.표 ?" in _src("common_util/common_util_line_stack.ts")
|
||||
|
||||
|
||||
def test_공식_묶음_격자_긴_이름_줄임() -> None:
|
||||
"""804-9(요구 692-3) — 공식 묶음 = 폭만큼 여러 열 · 머리 · 식 글 · 고치는 줄 = 열 합침 · 긴 이름 · 표 단추 · 꼬리표 = 줄임표 + 마우스 글."""
|
||||
css = _src("A00_Common/line_stack.css")
|
||||
assert "grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));" in css
|
||||
assert ".lstk-line.k-공식 > .lstk-frow:is(.is-open, :has(> .lstk-expr))" in css
|
||||
assert ".ui-btn[data-clip] > .ui-btn__label" in _src("ui_template/ui_template_button.css")
|
||||
assert "clip?: boolean;" in _src("ui_template/ui_template_button.ts")
|
||||
rows = _src("A00_Common/line_stack_rows.ts")
|
||||
assert "clip: true," in rows and "attrs: { title: text }" in rows
|
||||
assert "name.title = `${show(id)} — ${name.title}`;" in rows
|
||||
|
||||
@@ -198,3 +198,14 @@
|
||||
.ui-btn-row--tight .ui-btn:has(> .ui-btn__icon) > .ui-btn__label {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* 긴 글 줄임(clip) — 칸 폭 안에서 줄임표 · 전체 글은 title */
|
||||
.ui-btn[data-clip] {
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
}
|
||||
.ui-btn[data-clip] > .ui-btn__label {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@@ -58,6 +58,8 @@ export interface ButtonOptions {
|
||||
type?: "button" | "submit" | "reset";
|
||||
/** 앞쪽 아이콘 요소 (선택) — 이름이면 단 크기 아이콘 */
|
||||
iconStart?: HTMLElement | IconName;
|
||||
/** 긴 글 = 칸 폭 안에서 줄임표 · 마우스 글에 전체(`data-clip`) */
|
||||
clip?: boolean;
|
||||
}
|
||||
|
||||
export function createButton(opts: ButtonOptions): HTMLButtonElement {
|
||||
@@ -79,6 +81,10 @@ export function createButton(opts: ButtonOptions): HTMLButtonElement {
|
||||
btn.append(mark);
|
||||
}
|
||||
btn.append(el("span", { className: "ui-btn__label", text: opts.label }));
|
||||
if (opts.clip) {
|
||||
btn.dataset.clip = "";
|
||||
btn.title = opts.label;
|
||||
}
|
||||
if (opts.disabled) btn.disabled = true;
|
||||
if (opts.onClick) btn.addEventListener("click", opts.onClick);
|
||||
return btn;
|
||||
|
||||
Reference in New Issue
Block a user