Page MenuHomeSealhub

radio.ts
No OneTemporary

radio.ts

import { Context } from "koa";
import { FormField } from "../fields/field.js";
import { FormDataValue } from "../form-types.js";
import { Tickable } from "./tickable.js";
export class Radio extends Tickable<string> {
type = <const>"radio";
constructor(
public field: FormField<boolean, string>,
public value: string,
options: { label?: string }
) {
super(field, options);
}
makeInputID(): string {
return this.field.name + "-" + this.value.replaceAll(/\W/g, "-");
}
getValueAttribute(): string {
return this.value;
}
getWrapperClasses(
ctx: Context,
data: Record<string, FormDataValue>,
value: string
): string[] {
return [
...super.getWrapperClasses(ctx, data, value),
this.value.replaceAll(/\W/g, "-"),
];
}
isChecked(
_ctx: Context,
_data: Record<string, FormDataValue>,
value: string
): boolean {
return this.value === value;
}
}

File Metadata

Mime Type
text/x-java
Expires
Tue, May 27, 23:46 (3 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
625465
Default Alt Text
radio.ts (890 B)

Event Timeline