Small fixes to OH visualization

This commit is contained in:
Pieter Vander Vennet 2020-10-11 22:37:55 +02:00
parent 4db1997ed6
commit c9478c100a
5 changed files with 55 additions and 13 deletions

View file

@ -4,13 +4,26 @@ import {UIEventSource} from "../Logic/UIEventSource";
export default class SpecialVisualizations {
public static specialVisualizations: { funcName: string, constr: ((tagSource: UIEventSource<any>, argument: string) => UIElement) }[] =
public static specialVisualizations: {
funcName: string,
constr: ((tagSource: UIEventSource<any>, argument: string[]) => UIElement),
docs: string,
args: {name: string, defaultValue: string, doc: string}[]
}[] =
[{
funcName: "opening_hours_table",
constr: (tagSource: UIEventSource<any>, keyname) => {
docs: "Creates an opening-hours table. Usage: {opening_hours_table(opening_hours)} to create a table of the tag 'opening_hours'.",
args:[{name:"key", defaultValue: "opening_hours", doc: "The tag from which the table is constructed"}],
constr: (tagSource: UIEventSource<any>, args) => {
let keyname = args[0];
if (keyname === undefined || keyname === "") {
keyname = keyname ?? "opening_hours"
}
return new OpeningHoursVisualization(tagSource, keyname)
}
}]
},
]
}