Huge refactoring (WIP)

This commit is contained in:
Pieter Vander Vennet 2020-10-27 01:01:34 +01:00
parent 62c4f0a928
commit 895aa132ec
55 changed files with 1177 additions and 2190 deletions

View file

@ -49,6 +49,9 @@ export default class ValidatedTextField {
ValidatedTextField.tp(
"string",
"A basic string"),
ValidatedTextField.tp(
"text",
"A string, but allows input of longer strings more comfortably (a text area)"),
ValidatedTextField.tp(
"date",
"A date",
@ -171,6 +174,9 @@ export default class ValidatedTextField {
return new DropDown<string>("", values)
}
/**
* {string (typename) --> TextFieldDef}
*/
public static AllTypes = ValidatedTextField.allTypesDict();
public static InputForType(type: string, options?: {
@ -186,6 +192,7 @@ export default class ValidatedTextField {
const tp: TextFieldDef = ValidatedTextField.AllTypes[type]
const isValidTp = tp.isValid;
let isValid;
options.textArea = options.textArea ?? type === "text";
if (options.isValid) {
const optValid = options.isValid;
isValid = (str, country) => {