Page MenuHomeSealhub

component-input-enum.ts
No OneTemporary

component-input-enum.ts

import type { Enum } from "@sealcode/jdd";
import { printArgPath } from "./print-arg-path.js";
export function ComponentInputEnum<State, S extends string, T extends Enum<S>>({
arg_path,
arg,
value,
onchange,
}: {
state: State;
arg_path: string[];
arg: T;
value: string;
onchange?: string;
}) {
return /* HTML */ `<div id=${`component-input-enum-${arg_path.join("-")}`}>
<label>
${arg_path.at(-1) || ""}
<select
name="${`$${printArgPath(arg_path)}`}"
onchange="${onchange || ""}"
>
${arg.values
.map(
(v: S) => /* HTML */ `<option
value="${v}"
${value == v ? "selected" : ""}
>
${v}
</option>`
)
.join("")}
</select>
</label>
</div>`;
}

File Metadata

Mime Type
text/x-java
Expires
Tue, Dec 24, 14:05 (10 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
557310
Default Alt Text
component-input-enum.ts (730 B)

Event Timeline