|
|
import * as _WidgetBase from "dijit/_WidgetBase";
|
|
|
import { watch } from "./traits";
|
|
|
|
|
|
interface ScheduleWidgetAttrs {
|
|
|
data: string[];
|
|
|
}
|
|
|
|
|
|
interface ScheduleWidgetEvents {
|
|
|
"scheduled": Event & {
|
|
|
detail: {
|
|
|
startDate: Date,
|
|
|
endDate: Date
|
|
|
}
|
|
|
};
|
|
|
}
|
|
|
|
|
|
class ScheduleWidget extends _WidgetBase<ScheduleWidgetAttrs, ScheduleWidgetEvents> {
|
|
|
data: string[];
|
|
|
|
|
|
_onClick() {
|
|
|
this.set("data", "", "");
|
|
|
|
|
|
const t = this.get("title");
|
|
|
this.set({
|
|
|
data: ["",""]
|
|
|
});
|
|
|
}
|
|
|
|
|
|
render(){
|
|
|
watch(this, "title", v => String(v) );
|
|
|
}
|
|
|
}
|
|
|
|
|
|
const w = new ScheduleWidget({title: "Year schedule", data: ["a", "b"] });
|
|
|
|
|
|
w.get("data");
|
|
|
|
|
|
w.set("data", "a","b");
|
|
|
w.set({
|
|
|
data: ["a", "b"]
|
|
|
});
|
|
|
|
|
|
w.watch((p, o, n) => [p,o,n]);
|
|
|
|
|
|
w.watch("data", (p, o, n) => [p,o,n]);
|
|
|
|
|
|
watch(w, "title", v => String(v) );
|
|
|
watch(w, "data", v => String(v) );
|
|
|
|
|
|
w.emit("scheduled", { detail: { startDate: new Date(), endDate: new Date()} });
|
|
|
|
|
|
w.emit("click", {} );
|
|
|
|
|
|
w.emit("click", {} );
|
|
|
|
|
|
w.emit("some-extra-event", {});
|
|
|
|
|
|
w.on("click", e => e);
|
|
|
w.on("some-extra-event", e => e);
|
|
|
|