-
Notifications
You must be signed in to change notification settings - Fork 2
/
widget.ts
64 lines (50 loc) · 1.41 KB
/
widget.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import { Div } from "./div";
import { Component, log } from "./core";
class Widget extends Div {
public static htmlString:string = `<div></div>`;
constructor(text: string="", props:any=null) {
super(props);
this.createNode();
///
if (props) {
if (props.parent) {
this.appendTo(props.parent);
}
if (props.tip) {
this.Tip(props.tip)
}
}
}
children() : any {
// Return array of children nodes.
return this.node.childNodes;
}
appendChild(child:Component){
// Delete a specific child node from the widget
child.appendTo(this);
}
deleteChild(child:Component){
// Delete a specific child node from the widget
//this.node.removeChild(child.node);
child.delete();
}
deleteChildren(list:Component[]) {
// Delete all children from the current widget which are in a given list:
for (let item of list) {
item.delete();
}
}
appendChildren(list:Component[]) {
// Append children from a givent "Component" list to the current "Widget".
for (let item of list) {
item.appendTo(this);
}
}
show() {
// Cancel hide(). Make current widget visible.
}
hide() {
// Make current Widget invisible.
}
}
export { Widget };