-
Notifications
You must be signed in to change notification settings - Fork 0
/
xui.html
150 lines (146 loc) · 4.15 KB
/
xui.html
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<html>
<head>
<link href="./reset.css" rel="stylesheet" />
<link href="./xui.css" rel="stylesheet" />
<script src="./xmo.js"></script>
<script src="./xui.js"></script>
</head>
<body id="page"></body>
<script>
(function() {
"use strict";
const radioGroup = new xui.RadioGroup();
const root = xui.new({
type: "root",
class: "x",
layout: {
type: "vbox",
gap: 10
},
padding: 10,
children: [
{
type: "panel",
text: "MenuBar",
padding: 2,
children: [
{
type: "menubar",
children: [
{
type: "menuitem",
text: "Menu1",
children: [
{ type: "menuitem", text: "Submenu1" },
{ type: "menuitem", text: "Submenu2" },
{ type: "menuitem", text: "Submenu3" },
{ type: "menuitem", text: "Submenu4" },
{ type: "menuitem", text: "Submenu5" }
]
},
{
type: "menuitem",
text: "Menu2",
children: [
{ type: "menuitem", text: "Submenu1" },
{ type: "menuitem", text: "Submenu2" },
{ type: "menuitem", text: "Submenu3" },
{ type: "menuitem", text: "Submenu4" },
{ type: "menuitem", text: "Submenu5" }
]
}
]
}
]
},
{
type: "panel",
text: "ToolBar",
padding: 2,
children: [
{
type: "toolbar",
children: [
{ type: "toolbutton", text: "Tool1" },
{ type: "toolbutton", text: "Tool2" }
]
}
]
},
{
type: "panel",
text: "Grid Layout (collapsible)",
collapsible: true,
padding: 2,
layout: {
type: "grid",
rowGap: 2,
columnGap: 2,
columnCount: 2,
justify: "stretch",
alignment: "center"
},
children: [
{ type: "button" , text : "Button1" },
{ type: "button" , text : "Button2" },
{ type: "button" , text : "Button3" },
{ type: "button" , text : "Button4" },
{ type: "button" , text : "Button5" },
{ type: "textfield", placeholder: "Write something..." },
{ type: "text" , text: "Some Text" },
{ type: "checkbox" , value: true, text: "CheckBox1" },
{ type: "text" , text: "Some Text" },
{ type: "checkbox" , value: false, html: "<b>CheckBox2 <span style='color: #aff;'>Rich</span></b>" },
{ type: "text" , text: "Some Text" },
{ type: "checkbox" , value: 2, text: "CheckBox3 indeterminate" },
{ type: "text" , text: "Some text" },
{ type: "radiobox" , value: true, text: "RadioBox1", radioGroup: radioGroup },
{ type: "text" , text: "Some text" },
{ type: "radiobox" , value: false, text: "RadioBox2", radioGroup: radioGroup }
]
},
{
type: "panel",
text: "HBox Layout (collapsible)",
collapsible: true,
layout: {
type: "hbox",
justify: "stretch",
gap: 2
},
padding: 2,
children: [
{ type: "button" , text : "Button1" },
{ type: "button" , text : "Button2" },
{ type: "button" , text : "Button3" },
{ type: "button" , text : "Button4" },
{ type: "button" , text : "Button5" },
{ type: "textfield", value: "Some Input" }
]
},
{
type: "panel",
text: "ListView (collapsible)",
collapsible: true,
layout: {
type: "vbox",
gap: 2
},
padding: 2,
children: [
{
type: "listview",
as: "$list",
height: 250
}
]
}
]
});
for (var i = 0; i < 100; i++) {
root.$list.append(xui.new({ type: "listitem", text: `Item${i}` }));
}
root.attachToBody();
})();
</script>
</html>