MCPcopy Create free account
hub / github.com/MathMan05/Fermi / SettingsText

Class SettingsText

src/webpage/settings.ts:260–284  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258class DateInput extends TextInput {
259 dateValue: Date | null;
260 constructor(
261 label: string,
262 onSubmit: (str: string) => void,
263 owner: Options,
264 {initText = "" as string | Date} = {},
265 ) {
266 let initDate: DateInput["dateValue"] = null;
267 if (initText instanceof Date) {
268 initDate = initText;
269 initText = "";
270 }
271 super(label, onSubmit, owner, {initText});
272 this.dateValue = initDate;
273 }
274 generateHTML(): HTMLDivElement {
275 const div = document.createElement("div");
276 const span = document.createElement("span");
277 span.textContent = this.label;
278 div.append(span);
279 const input = document.createElement("input");
280 input.value = this.value;
281 input.type = "date";
282 if (this.dateValue) input.valueAsDate = this.dateValue;
283 input.oninput = this.onChange.bind(this);
284 this.input = new WeakRef(input);
285 div.append(input);
286 return div;
287 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected