Add fancy direction picker

This commit is contained in:
Pieter Vander Vennet 2020-11-15 03:10:44 +01:00
parent 67bd817a38
commit 7ef2f429f2
11 changed files with 386 additions and 53 deletions

View file

@ -9,6 +9,7 @@ import {UIEventSource} from "../../Logic/UIEventSource";
import CombinedInputElement from "./CombinedInputElement";
import SimpleDatePicker from "./SimpleDatePicker";
import OpeningHoursInput from "./OpeningHours/OpeningHoursInput";
import DirectionInput from "./DirectionInput";
interface TextFieldDef {
name: string,
@ -97,6 +98,17 @@ export default class ValidatedTextField {
str = "" + str;
return str !== undefined && str.indexOf(".") < 0 && !isNaN(Number(str)) && Number(str) > 0
}),
ValidatedTextField.tp(
"direction",
"A geographical direction, in degrees. 0° is north, 90° is east",
(str) => {
str = "" + str;
return str !== undefined && str.indexOf(".") < 0 && !isNaN(Number(str)) && Number(str) > 0 && Number(str) <= 360
},str => str,
(value) => {
return new DirectionInput(value);
}
),
ValidatedTextField.tp(
"float",
"A decimal",