forked from MapComplete/MapComplete
Reformat all files with prettier
This commit is contained in:
parent
e22d189376
commit
b541d3eab4
382 changed files with 50893 additions and 35566 deletions
|
@ -1,45 +1,38 @@
|
|||
import {InputElement} from "./InputElement";
|
||||
import {UIEventSource} from "../../Logic/UIEventSource";
|
||||
import { InputElement } from "./InputElement"
|
||||
import { UIEventSource } from "../../Logic/UIEventSource"
|
||||
|
||||
export default class SimpleDatePicker extends InputElement<string> {
|
||||
|
||||
IsSelected: UIEventSource<boolean> = new UIEventSource<boolean>(false);
|
||||
IsSelected: UIEventSource<boolean> = new UIEventSource<boolean>(false)
|
||||
private readonly value: UIEventSource<string>
|
||||
private readonly _element: HTMLElement;
|
||||
private readonly _element: HTMLElement
|
||||
|
||||
constructor(
|
||||
value?: UIEventSource<string>
|
||||
) {
|
||||
super();
|
||||
this.value = value ?? new UIEventSource<string>(undefined);
|
||||
const self = this;
|
||||
constructor(value?: UIEventSource<string>) {
|
||||
super()
|
||||
this.value = value ?? new UIEventSource<string>(undefined)
|
||||
const self = this
|
||||
|
||||
const el = document.createElement("input")
|
||||
this._element = el;
|
||||
this._element = el
|
||||
el.type = "date"
|
||||
el.oninput = () => {
|
||||
// Already in YYYY-MM-DD value!
|
||||
self.value.setData(el.value);
|
||||
// Already in YYYY-MM-DD value!
|
||||
self.value.setData(el.value)
|
||||
}
|
||||
|
||||
|
||||
this.value.addCallbackAndRunD(v => {
|
||||
el.value = v;
|
||||
});
|
||||
|
||||
|
||||
this.value.addCallbackAndRunD((v) => {
|
||||
el.value = v
|
||||
})
|
||||
}
|
||||
|
||||
GetValue(): UIEventSource<string> {
|
||||
return this.value;
|
||||
return this.value
|
||||
}
|
||||
|
||||
IsValid(t: string): boolean {
|
||||
return !isNaN(new Date(t).getTime());
|
||||
return !isNaN(new Date(t).getTime())
|
||||
}
|
||||
|
||||
protected InnerConstructElement(): HTMLElement {
|
||||
return this._element
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue