##// END OF EJS Templates
Added tag v1.1.1 for changeset ff3695b0a48f
Added tag v1.1.1 for changeset ff3695b0a48f

File last commit:

r65:8ac132c83639 default
r68:f8b14ecb1f6f default
Show More
MyWidget.tsx
50 lines | 1.3 KiB | text/x-typescript | TypeScriptLexer
/ djx / src / test / ts / view / MyWidget.tsx
cin
Converted to subproject djx, removed dojo-typings
r65 import { djbase, djclass, bind, prototype, AbstractConstructor } from "../declare";
import { DjxWidgetBase } from "../tsx/DjxWidgetBase";
import { createElement } from "../tsx";
interface MyWidgetAttrs {
title: string;
counter: number;
}
interface MyWidgetEvents {
"count-inc": Event;
"count-dec": Event;
}
@djclass
export class MyWidget extends djbase(DjxWidgetBase as AbstractConstructor<DjxWidgetBase<MyWidgetAttrs, MyWidgetEvents>>) {
@bind({ node: "titleNode", type: "innerHTML" })
title = "";
@prototype()
counter = 0;
render() {
const Frame = (props: any) => <div>{props.children}</div>;
return <div className="myWidget" onsubmit={e => this._onSubmit(e)} tabIndex={3} style={{ alignContent: "center", border: "1px solid" }} >
<h1 data-dojo-attach-point="titleNode"></h1>
<Frame>
<span class="up-button" onclick={e => this._onIncClick(e)}>[+]</span>
<span class="down-button" onclick={() => this._onDecClick()}>[-]</span>
</Frame>
</div>;
}
_onSubmit(e: Event) {
}
_onIncClick(e: MouseEvent) {
this.emit("count-inc", { bubbles: false });
}
_onDecClick() {
this.emit("count-dec", { bubbles: false });
}
}