@@ -10,7 +10,7 | |||
|
10 | 10 | ], |
|
11 | 11 | "author": "Implab team", |
|
12 | 12 | "license": "BSD-2-Clause", |
|
13 |
"repository": "https:// |
|
|
13 | "repository": "https://code.implab.org/implab/implabjs-djx", | |
|
14 | 14 | "publishConfig": { |
|
15 | 15 | "access": "public" |
|
16 | 16 | }, |
@@ -21,7 +21,7 export interface DjxWidgetBase<Attrs = a | |||
|
21 | 21 | |
|
22 | 22 | on<K extends keyof Events & string>(eventName: K, cb: (evt: Events[K]) => void): dojo.WatchHandle; |
|
23 | 23 | |
|
24 |
emit<K extends keyof Events & string>(eventName: K, evt: Omit<Events[K], keyof Event> & EventArgs |
|
|
24 | emit<K extends keyof Events & string>(eventName: K, evt: Omit<Events[K], keyof Event> & EventArgs): void; | |
|
25 | 25 | } |
|
26 | 26 | |
|
27 | 27 | @djclass |
@@ -30,6 +30,16 export abstract class DjxWidgetBase<Attr | |||
|
30 | 30 | buildRendering() { |
|
31 | 31 | this.domNode = this.render().getDomNode(); |
|
32 | 32 | super.buildRendering(); |
|
33 | ||
|
34 | // now we should get assigned data-dojo-attach-points | |
|
35 | // place the contents of the original srcNode to the containerNode | |
|
36 | const src = this.srcNodeRef; | |
|
37 | const dest = this.containerNode; | |
|
38 | ||
|
39 | if (src && dest) { | |
|
40 | while (src.firstChild) | |
|
41 | dest.appendChild(src.firstChild); | |
|
42 | } | |
|
33 | 43 | } |
|
34 | 44 | |
|
35 | 45 | abstract render(): BuildContext<HTMLElement>; |
@@ -68,7 +78,8 export abstract class DjxWidgetBase<Attr | |||
|
68 | 78 | } |
|
69 | 79 | |
|
70 | 80 | /** Starts current widget and all its supporting widgets (placed outside |
|
71 |
* `containerNode`) and child widgets (placed inside `containerNode`) |
|
|
81 | * `containerNode`) and child widgets (placed inside `containerNode`) | |
|
82 | */ | |
|
72 | 83 | startup() { |
|
73 | 84 | // startup supporting widgets |
|
74 | 85 | startupWidgets(this.domNode, this.containerNode); |
@@ -27,7 +27,7 export class MyWidget extends djbase(Djx | |||
|
27 | 27 | |
|
28 | 28 | render() { |
|
29 | 29 | const Frame = (props: any) => <div>{props.children}</div>; |
|
30 | return <div className="myWidget" tabIndex={3} style={{ alignContent: "center", border: "1px solid" }} > | |
|
30 | return <div className="myWidget" onsubmit={e => this._onSubmit(e)} tabIndex={3} style={{ alignContent: "center", border: "1px solid" }} > | |
|
31 | 31 | <h1 data-dojo-attach-point="titleNode"></h1> |
|
32 | 32 | <Frame> |
|
33 | 33 | <span class="up-button" onclick={e => this._onIncClick(e)}>[+]</span> |
@@ -36,6 +36,10 export class MyWidget extends djbase(Djx | |||
|
36 | 36 | </div>; |
|
37 | 37 | } |
|
38 | 38 | |
|
39 | _onSubmit(e: Event) { | |
|
40 | ||
|
41 | } | |
|
42 | ||
|
39 | 43 | _onIncClick(e: MouseEvent) { |
|
40 | 44 | this.emit("count-inc", { bubbles: false }); |
|
41 | 45 | } |
General Comments 0
You need to be logged in to leave comments.
Login now