import {UIEventSource} from "../../Logic/UIEventSource"; import OpeningHoursPickerTable from "./OpeningHoursPickerTable"; import {OH, OpeningHour} from "./OpeningHours"; import {InputElement} from "../Input/InputElement"; import BaseUIElement from "../BaseUIElement"; export default class OpeningHoursPicker extends InputElement { public readonly IsSelected: UIEventSource = new UIEventSource(false); private readonly _ohs: UIEventSource; private readonly _backgroundTable: OpeningHoursPickerTable; constructor(ohs: UIEventSource = new UIEventSource([])) { super(); this._ohs = ohs; ohs.addCallback(oh => { ohs.setData(OH.MergeTimes(oh)); }) this._backgroundTable = new OpeningHoursPickerTable(this._ohs); this._backgroundTable.ConstructElement() } InnerRender(): BaseUIElement { return this._backgroundTable; } GetValue(): UIEventSource { return this._ohs } IsValid(t: OpeningHour[]): boolean { return true; } protected InnerConstructElement(): HTMLElement { return this._backgroundTable.ConstructElement(); } }