-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwj-input-date.ts
36 lines (28 loc) · 1019 Bytes
/
wj-input-date.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import {inject, customElement, bindable} from "aurelia-framework";
import {bindingMode as BindingMode} from "aurelia-binding";
@inject(Element)
@customElement("wj-input-date")
export class WjInputDate {
element: HTMLElement;
inputDate: wijmo.input.InputDate;
@bindable selectedDate: Date;
@bindable disabled: boolean;
constructor(element: HTMLElement) {
this.element = element;
}
selectedDateChanged(newValue: Date, oldValue: Date) {
if (this.inputDate) this.inputDate.value = newValue;
}
disabledChanged(newValue: any, oldValue: any) {
if (this.inputDate) this.inputDate.disabled = newValue;
}
attached() {
this.inputDate = new wijmo.input.InputDate(this.element);
this.inputDate.disabled = this.disabled;
this.inputDate.required = false;
this.inputDate.value = this.selectedDate;
this.inputDate.valueChanged.addHandler(() => {
this.selectedDate = this.inputDate.value;
});
}
}