()
| 2260 | this.names.set(formName, colorInput); |
| 2261 | if (required) { |
| 2262 | this.required.add(colorInput); |
| 2263 | } |
| 2264 | return colorInput; |
| 2265 | } |
| 2266 | |
| 2267 | addMDInput(label: string, formName: string, {initText = "", required = false} = {}) { |
| 2268 | const mdInput = this.options.addMDInput(label, (_) => {}, {initText}); |
| 2269 | this.names.set(formName, mdInput); |
| 2270 | if (required) { |
| 2271 | this.required.add(mdInput); |
| 2272 | } |
| 2273 | return mdInput; |
| 2274 | } |
| 2275 | /** |
| 2276 | * This function does not integrate with the form, so be aware of that |
| 2277 | * |
| 2278 | */ |
| 2279 | addButtonInput(label: string, textContent: string, onSubmit: () => void) { |
| 2280 | return this.options.addButtonInput(label, textContent, onSubmit); |
| 2281 | } |
| 2282 | /** |
| 2283 | * This function does not integrate with the form, so be aware of that |
| 2284 | * |
| 2285 | */ |
| 2286 | addOptions(name: string, {ltr = false, noSubmit = false} = {}) { |
| 2287 | return this.options.addOptions(name, {ltr, noSubmit}); |
| 2288 | } |
| 2289 | addCheckboxInput(label: string, formName: string, {initState = false, required = false} = {}) { |
| 2290 | const box = this.options.addCheckboxInput(label, (_) => {}, {initState}); |
| 2291 | this.names.set(formName, box); |
| 2292 | if (required) { |
| 2293 | this.required.add(box); |
| 2294 | } |
| 2295 | return box; |
| 2296 | } |
| 2297 | addText(str: string) { |
| 2298 | return this.options.addText(str); |
| 2299 | } |
| 2300 | addMDText(str: MarkDown) { |
| 2301 | return this.options.addMDText(str); |
| 2302 | } |
| 2303 | addHR() { |
| 2304 | return this.options.addHR(); |
| 2305 | } |
| 2306 | addTitle(str: string) { |
| 2307 | this.options.addTitle(str); |
| 2308 | } |
| 2309 | handleError(error: FormError) { |
| 2310 | this.onFormError(error); |
| 2311 | const elm = this.options.html.get(error.elem); |
| 2312 | if (elm) { |
| 2313 | const html = elm.deref(); |
| 2314 | if (html) { |
| 2315 | this.makeError(html, error.message); |
| 2316 | } |
| 2317 | } |
| 2318 | } |
| 2319 | button!: WeakRef<HTMLButtonElement>; |
no test coverage detected