quickwin 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +197 -0
- package/README.md +196 -0
- package/examples/PdfCanvas.js +67 -0
- package/examples/PdfCanvas.tsx +83 -0
- package/examples/pdf_preview2.js +431 -0
- package/examples/pdf_preview2.ts +375 -0
- package/examples/pdf_viewer.js +17623 -0
- package/examples/pdf_viewer.tsx +279 -0
- package/examples/test_gallery.js +17452 -0
- package/examples/test_gallery.tsx +285 -0
- package/examples/test_react_lazy.js +17336 -0
- package/examples/test_react_lazy.tsx +63 -0
- package/examples/test_react_listbox.js +17339 -0
- package/examples/test_react_listbox.tsx +71 -0
- package/examples/test_root_window.js +17313 -0
- package/examples/test_root_window.tsx +41 -0
- package/examples/test_tab.js +17339 -0
- package/examples/test_tab.tsx +75 -0
- package/examples/tray_demo.js +79 -0
- package/examples/tray_demo.tsx +81 -0
- package/lib/assert.js +8 -0
- package/lib/assert.ts +7 -0
- package/lib/cache-utils.js +43 -0
- package/lib/cache-utils.ts +40 -0
- package/lib/dumpRects.js +25 -0
- package/lib/dumpRects.ts +25 -0
- package/lib/fetch.js +490 -0
- package/lib/fetch.ts +502 -0
- package/lib/http-common.js +342 -0
- package/lib/http-common.ts +399 -0
- package/lib/http-server.js +416 -0
- package/lib/http-server.ts +424 -0
- package/lib/polyfill.js +156 -0
- package/lib/polyfill.ts +171 -0
- package/lib/react-qw/components/Button.js +8 -0
- package/lib/react-qw/components/CheckBox.js +31 -0
- package/lib/react-qw/components/ComboBox.js +42 -0
- package/lib/react-qw/components/DateTimePicker.js +96 -0
- package/lib/react-qw/components/Input.js +50 -0
- package/lib/react-qw/components/Link.js +43 -0
- package/lib/react-qw/components/ListBox.js +48 -0
- package/lib/react-qw/components/ListView.js +328 -0
- package/lib/react-qw/components/PathPicker.js +136 -0
- package/lib/react-qw/components/ProgressBar.js +22 -0
- package/lib/react-qw/components/RadioButton.js +31 -0
- package/lib/react-qw/components/ScrollView.js +139 -0
- package/lib/react-qw/components/Slider.js +45 -0
- package/lib/react-qw/components/Tab.js +61 -0
- package/lib/react-qw/components/Tooltip.js +55 -0
- package/lib/react-qw/components/TreeView.js +130 -0
- package/lib/react-qw/components/index.js +16 -0
- package/lib/react-qw/components/index.ts +17 -0
- package/lib/react-qw/index.js +73 -0
- package/lib/react-qw/index.ts +90 -0
- package/lib/react-qw/jsx.d.ts +34 -0
- package/lib/react-qw/layout.js +82 -0
- package/lib/react-qw/layout.ts +111 -0
- package/lib/react-qw/props.js +27 -0
- package/lib/react-qw/props.ts +36 -0
- package/lib/react-qw/reconciler.js +333 -0
- package/lib/react-qw/reconciler.ts +373 -0
- package/lib/stream.js +2 -0
- package/lib/stream.ts +22 -0
- package/lib/text-codec.js +197 -0
- package/lib/text-codec.ts +171 -0
- package/lib/text-measure.js +52 -0
- package/lib/text-measure.ts +54 -0
- package/lib/url.js +278 -0
- package/lib/url.ts +201 -0
- package/lib/vendor/web-streams/ponyfill.d.mts +829 -0
- package/lib/vendor/web-streams/ponyfill.mjs +8 -0
- package/lib/websocket.js +541 -0
- package/lib/websocket.ts +555 -0
- package/package.json +44 -0
- package/quickwin.d.ts +594 -0
- package/quickwin_const.d.ts +900 -0
- package/qwin-nowasm.exe +0 -0
- package/qwin.exe +0 -0
- package/test/add.wasm +0 -0
- package/test/complex.wasm +0 -0
- package/test/complex_imports.wasm +0 -0
- package/test/debug/http_server_e2e.js +31 -0
- package/test/debug/minwasm.js +52 -0
- package/test/debug/mupdf_debug.js +104 -0
- package/test/debug/wasm.js +122 -0
- package/test/debug/wasm_export_debug.js +64 -0
- package/test/debug/wasm_names.js +46 -0
- package/test/global_imports.wasm +0 -0
- package/test/import_func.wasm +0 -0
- package/test/imports.wasm +0 -0
- package/test/run.js +91 -0
- package/test/run.ts +96 -0
- package/test/sjlj.wasm +0 -0
- package/test/test_basic.js +7 -0
- package/test/test_basic.ts +9 -0
- package/test/test_basic_fetch.js +34 -0
- package/test/test_basic_fetch.ts +33 -0
- package/test/test_brotli.js +48 -0
- package/test/test_brotli.ts +52 -0
- package/test/test_fetch_cache.js +169 -0
- package/test/test_fetch_cache.ts +187 -0
- package/test/test_ffi.js +157 -0
- package/test/test_ffi.ts +174 -0
- package/test/test_frame_encoding.js +128 -0
- package/test/test_frame_encoding.ts +132 -0
- package/test/test_helper.js +84 -0
- package/test/test_helper.ts +80 -0
- package/test/test_http_import.js +78 -0
- package/test/test_http_import.ts +74 -0
- package/test/test_http_server.js +142 -0
- package/test/test_http_server.ts +136 -0
- package/test/test_import_dir.js +4 -0
- package/test/test_import_dir.ts +5 -0
- package/test/test_ipv6.js +134 -0
- package/test/test_ipv6.ts +129 -0
- package/test/test_jsx.js +1314 -0
- package/test/test_meta_url.js +3 -0
- package/test/test_meta_url.ts +4 -0
- package/test/test_mupdf_render.js +69 -0
- package/test/test_mupdf_render.ts +74 -0
- package/test/test_mupdf_twice.js +77 -0
- package/test/test_mupdf_twice.ts +81 -0
- package/test/test_mupdf_wasm.js +33 -0
- package/test/test_mupdf_wasm.ts +30 -0
- package/test/test_net_event.js +57 -0
- package/test/test_net_event.ts +55 -0
- package/test/test_net_fetch.js +259 -0
- package/test/test_net_fetch.ts +238 -0
- package/test/test_net_websocket.js +180 -0
- package/test/test_net_websocket.ts +164 -0
- package/test/test_polyfill.js +144 -0
- package/test/test_polyfill.ts +159 -0
- package/test/test_react_complex.js +17440 -0
- package/test/test_react_counter.js +17331 -0
- package/test/test_react_flex.js +17643 -0
- package/test/test_react_hidden.js +17336 -0
- package/test/test_react_listview_link.js +17371 -0
- package/test/test_react_render.js +17326 -0
- package/test/test_url.js +173 -0
- package/test/test_url.ts +183 -0
- package/test/test_wasm_basic.js +85 -0
- package/test/test_wasm_basic.ts +73 -0
- package/test/test_wasm_import_global.js +41 -0
- package/test/test_wasm_import_global.ts +45 -0
- package/test/test_wasm_sjlj.js +145 -0
- package/test/test_wasm_sjlj.ts +125 -0
- package/test/test_wasm_types.js +97 -0
- package/test/test_wasm_types.ts +124 -0
- package/test/test_worker.js +21 -0
- package/test/test_worker.ts +24 -0
- package/test/test_worker_fetch.js +26 -0
- package/test/test_worker_fetch.ts +27 -0
- package/test/test_worker_net.js +51 -0
- package/test/test_worker_net.ts +54 -0
- package/test/test_worker_wasm_concurrent.js +44 -0
- package/test/test_worker_wasm_concurrent.ts +45 -0
- package/test/types.wasm +0 -0
- package/test/worker_fetch.js +13 -0
- package/test/worker_fetch.ts +13 -0
- package/test/worker_helper.js +1 -0
- package/test/worker_helper.ts +1 -0
- package/test/worker_http.js +18 -0
- package/test/worker_http.ts +20 -0
- package/test/worker_import_lib.js +12 -0
- package/test/worker_import_lib.ts +13 -0
- package/test/worker_module.js +16 -0
- package/test/worker_module.ts +17 -0
- package/test/worker_wasm_concurrent.js +22 -0
- package/test/worker_wasm_concurrent.ts +22 -0
- package/tsconfig.json +27 -0
- package/vendor/mupdf-wasm/mupdf-wasm.d.ts +571 -0
- package/vendor/mupdf-wasm/mupdf-wasm.js +2749 -0
- package/vendor/mupdf-wasm/mupdf-wasm.wasm +0 -0
- package/vendor/mupdf-wasm/mupdf.d.ts +939 -0
- package/vendor/mupdf-wasm/mupdf.js +3317 -0
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import '../lib/polyfill.js'
|
|
2
|
+
import * as gui from 'gui'
|
|
3
|
+
import { useState } from 'react'
|
|
4
|
+
import {
|
|
5
|
+
render, Button, Input, CheckBox, ProgressBar, ComboBox, Tab,
|
|
6
|
+
ListView, type Column, ListBox, ScrollView, RadioButton, Slider,
|
|
7
|
+
TreeView, type TreeNode, DateTimePicker, Link, Tooltip, PathPicker,
|
|
8
|
+
} from '../lib/react-qw/index.js'
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
gui.RegisterClass('Gallery', (hwnd, msg, wParam, lParam) => {
|
|
12
|
+
if (!hwnd) return gui.DefWindowProc(hwnd, msg, wParam, lParam)
|
|
13
|
+
if (msg === gui.WmMsg.DESTROY) {
|
|
14
|
+
gui.PostQuitMessage(0)
|
|
15
|
+
return 0
|
|
16
|
+
}
|
|
17
|
+
return gui.DefWindowProc(hwnd, msg, wParam, lParam)
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const VISIBLE = gui.WindowStyle.VISIBLE
|
|
21
|
+
const CLIPCHILDREN = gui.WindowStyle.CLIPCHILDREN
|
|
22
|
+
|
|
23
|
+
interface Fruit {
|
|
24
|
+
name: string
|
|
25
|
+
color: string
|
|
26
|
+
origin: string
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const treeData: TreeNode[] = [
|
|
30
|
+
{
|
|
31
|
+
key: 'fruits', label: 'Fruits',
|
|
32
|
+
children: [
|
|
33
|
+
{ key: 'apple', label: 'Apple' },
|
|
34
|
+
{ key: 'banana', label: 'Banana' },
|
|
35
|
+
{ key: 'cherry', label: 'Cherry' },
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
key: 'veggies', label: 'Vegetables',
|
|
40
|
+
children: [
|
|
41
|
+
{ key: 'carrot', label: 'Carrot' },
|
|
42
|
+
{ key: 'broccoli', label: 'Broccoli' },
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
key: 'meats', label: 'Meats',
|
|
47
|
+
children: [
|
|
48
|
+
{ key: 'chicken', label: 'Chicken' },
|
|
49
|
+
{ key: 'beef', label: 'Beef' },
|
|
50
|
+
{ key: 'pork', label: 'Pork' },
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
function App({ svW, svH }: { svW: number; svH: number }) {
|
|
56
|
+
const [count, setCount] = useState(0)
|
|
57
|
+
const [disabled, setDisabled] = useState(true)
|
|
58
|
+
const [inputText, setInputText] = useState('')
|
|
59
|
+
const [checkA, setCheckA] = useState(true)
|
|
60
|
+
const [checkB, setCheckB] = useState(false)
|
|
61
|
+
const [progress, setProgress] = useState(30)
|
|
62
|
+
const [lbSel, setLbSel] = useState(0)
|
|
63
|
+
const [cbSel, setCbSel] = useState(-1)
|
|
64
|
+
const [radio, setRadio] = useState('a')
|
|
65
|
+
const [sliderVal, setSliderVal] = useState(50)
|
|
66
|
+
const [treeSel, setTreeSel] = useState<TreeNode | null>(null)
|
|
67
|
+
const [dtDate, setDtDate] = useState<Date | null>(new Date())
|
|
68
|
+
const [pickerPath, setPickerPath] = useState('')
|
|
69
|
+
const [listData, setListData] = useState<Fruit[]>([
|
|
70
|
+
{ name: 'Apple', color: 'Red', origin: 'China' },
|
|
71
|
+
{ name: 'Banana', color: 'Yellow', origin: 'Philippines' },
|
|
72
|
+
{ name: 'Cherry', color: 'Dark Red', origin: 'USA' },
|
|
73
|
+
{ name: 'Date', color: 'Brown', origin: 'Middle East' },
|
|
74
|
+
{ name: 'Elderberry', color: 'Purple', origin: 'Europe' },
|
|
75
|
+
{ name: 'Fig', color: 'Purple', origin: 'Turkey' },
|
|
76
|
+
{ name: 'Grape', color: 'Green', origin: 'Italy' },
|
|
77
|
+
])
|
|
78
|
+
const [listCols, setListCols] = useState<Column<Fruit>[]>([
|
|
79
|
+
{ name: 'Name', dataIndex: 'name' },
|
|
80
|
+
{ name: 'Color', dataIndex: 'color' },
|
|
81
|
+
{ name: 'Origin', dataIndex: 'origin' },
|
|
82
|
+
])
|
|
83
|
+
const lbItems = listData.map(f => f.name)
|
|
84
|
+
const cbItems = ['Red', 'Green', 'Blue', 'Yellow', 'Purple', 'Orange']
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<ScrollView style={{width:svW, height:svH}} contentHeight={1600}>
|
|
88
|
+
<w type="STATIC" ws={VISIBLE | CLIPCHILDREN | gui.WindowStyle.BORDER} style={{flexDirection:'column', gap:8, alignSelf:'stretch', flexGrow:1, padding:8}}>
|
|
89
|
+
{/* ===== 三列上半区 ===== */}
|
|
90
|
+
<w type="STATIC" ws={VISIBLE} style={{flexDirection:'row', gap:10, height:345}}>
|
|
91
|
+
|
|
92
|
+
{/* --- 左列: Buttons + CheckBoxes --- */}
|
|
93
|
+
<w type="STATIC" ws={VISIBLE | CLIPCHILDREN} style={{flexDirection:'column', gap:6, flexGrow:1}}>
|
|
94
|
+
<w type="STATIC" ws={VISIBLE} text="Buttons" style={{height:24}} />
|
|
95
|
+
<w type="STATIC" ws={VISIBLE} style={{flexDirection:'row', gap:6, alignItems:'stretch', height:30}}>
|
|
96
|
+
<Tooltip text="Click to increment counter" balloon>
|
|
97
|
+
<Button onClick={() => setCount(c => c + 1)} style={{flexGrow:1}}>
|
|
98
|
+
{`Clicked ${count} times`}
|
|
99
|
+
</Button>
|
|
100
|
+
</Tooltip>
|
|
101
|
+
<Button onClick={() => setCount(0)} style={{width:70}}>
|
|
102
|
+
Reset
|
|
103
|
+
</Button>
|
|
104
|
+
</w>
|
|
105
|
+
<w type="STATIC" ws={VISIBLE} style={{flexDirection:'row', gap:6, alignItems:'stretch', height:30}}>
|
|
106
|
+
<Button onClick={() => setDisabled(d => !d)} style={{flexGrow:1}}>
|
|
107
|
+
{`Toggle disabled (${String(disabled)})`}
|
|
108
|
+
</Button>
|
|
109
|
+
<Button disabled={disabled} style={{width:80}}>
|
|
110
|
+
Disabled
|
|
111
|
+
</Button>
|
|
112
|
+
</w>
|
|
113
|
+
<w type="STATIC" ws={VISIBLE} text="CheckBoxes" style={{height:24}} />
|
|
114
|
+
<CheckBox checked={checkA} onChange={setCheckA} label={`Option A (${String(checkA)})`} style={{height:26}} />
|
|
115
|
+
<CheckBox checked={checkB} onChange={setCheckB} label={`Option B (${String(checkB)})`} style={{height:26}} />
|
|
116
|
+
<CheckBox label="Disabled checkbox" disabled style={{height:26}} />
|
|
117
|
+
<w type="STATIC" ws={VISIBLE} text={`RadioButtons (${radio})`} style={{height:24}} />
|
|
118
|
+
<RadioButton checked={radio === 'a'} onChange={() => setRadio('a')} label="Option A" style={{height:24}} />
|
|
119
|
+
<RadioButton checked={radio === 'b'} onChange={() => setRadio('b')} label="Option B" style={{height:24}} />
|
|
120
|
+
<RadioButton checked={radio === 'c'} onChange={() => setRadio('c')} label="Option C" style={{height:24}} />
|
|
121
|
+
</w>
|
|
122
|
+
|
|
123
|
+
{/* --- 中列: Input + ProgressBar --- */}
|
|
124
|
+
<w type="STATIC" ws={VISIBLE | CLIPCHILDREN} style={{flexDirection:'column', gap:6, flexGrow:1}}>
|
|
125
|
+
<w type="STATIC" ws={VISIBLE} text="Input" style={{height:24}} />
|
|
126
|
+
<Input value={inputText} onChange={setInputText} placeholder="Type here..." style={{height:28}} />
|
|
127
|
+
<Input placeholder="Password" password style={{height:28}} />
|
|
128
|
+
<Input value="Read only" readonly style={{height:28}} />
|
|
129
|
+
<w type="STATIC" ws={VISIBLE} text="ProgressBar" style={{height:24}} />
|
|
130
|
+
<w type="STATIC" ws={VISIBLE} style={{flexDirection:'row', gap:6, alignItems:'stretch', height:24}}>
|
|
131
|
+
<ProgressBar value={progress} max={100} smooth style={{flexGrow:1}} />
|
|
132
|
+
<w type="STATIC" ws={VISIBLE} text={`${progress}%`} style={{width:40}} />
|
|
133
|
+
</w>
|
|
134
|
+
<w type="STATIC" ws={VISIBLE} style={{flexDirection:'row', gap:6, alignItems:'stretch', height:30}}>
|
|
135
|
+
<Button onClick={() => setProgress(p => Math.min(100, p + 10))} style={{flexGrow:1}}>
|
|
136
|
+
+10
|
|
137
|
+
</Button>
|
|
138
|
+
<Button onClick={() => setProgress(p => Math.max(0, p - 10))} style={{flexGrow:1}}>
|
|
139
|
+
-10
|
|
140
|
+
</Button>
|
|
141
|
+
<Button onClick={() => setProgress(0)} style={{width:50}}>
|
|
142
|
+
0
|
|
143
|
+
</Button>
|
|
144
|
+
</w>
|
|
145
|
+
<w type="STATIC" ws={VISIBLE} text={`Slider (${sliderVal})`} style={{height:24}} />
|
|
146
|
+
<Slider value={sliderVal} onChange={setSliderVal} min={0} max={100} style={{height:30}} />
|
|
147
|
+
</w>
|
|
148
|
+
|
|
149
|
+
{/* --- 右列: ListBox + ComboBox --- */}
|
|
150
|
+
<w type="STATIC" ws={VISIBLE | CLIPCHILDREN} style={{flexDirection:'column', gap:6, flexGrow:1}}>
|
|
151
|
+
<w type="STATIC" ws={VISIBLE} text={`ListBox (sel=${lbSel >= 0 ? lbItems[lbSel] : 'none'})`} style={{height:24}} />
|
|
152
|
+
<ListBox items={lbItems} selectedIndex={lbSel} onChange={(i) => setLbSel(i)} style={{flexGrow:1}} />
|
|
153
|
+
<w type="STATIC" ws={VISIBLE} text="ComboBox" style={{height:24}} />
|
|
154
|
+
<ComboBox items={cbItems} selectedIndex={cbSel} onChange={(i) => setCbSel(i)} style={{height:26}} />
|
|
155
|
+
<w type="STATIC" ws={VISIBLE}
|
|
156
|
+
text={cbSel >= 0 ? `Selected: ${cbItems[cbSel]}` : '(none selected)'}
|
|
157
|
+
style={{height:24}} />
|
|
158
|
+
</w>
|
|
159
|
+
</w>
|
|
160
|
+
|
|
161
|
+
{/* ===== Auto-Size ===== */}
|
|
162
|
+
<w type="STATIC" ws={VISIBLE} text="Auto-Size" style={{height:24}} />
|
|
163
|
+
<w type="STATIC" ws={VISIBLE | CLIPCHILDREN | gui.WindowStyle.BORDER} style={{flexDirection:'column', gap:6, alignSelf:'stretch', flexGrow:1}}>
|
|
164
|
+
<w type="STATIC" ws={VISIBLE} text="Buttons (auto width)" style={{height:24}} />
|
|
165
|
+
<w type="STATIC" ws={VISIBLE} style={{flexDirection:'row', gap:8, alignItems:'stretch', height:30}}>
|
|
166
|
+
<Button style={{width:'auto', height:30}}>OK</Button>
|
|
167
|
+
<Button style={{width:'auto', height:30}}>Cancel</Button>
|
|
168
|
+
<Button style={{width:'auto', height:30}}>A very long button text</Button>
|
|
169
|
+
</w>
|
|
170
|
+
<w type="STATIC" ws={VISIBLE} text="Statics (auto width)" style={{height:24}} />
|
|
171
|
+
<w type="STATIC" ws={VISIBLE} style={{flexDirection:'row', gap:8, alignItems:'stretch', height:24}}>
|
|
172
|
+
<w type="STATIC" ws={VISIBLE | gui.WindowStyle.BORDER} text="Short" style={{width:'auto', height:24}} />
|
|
173
|
+
<w type="STATIC" ws={VISIBLE | gui.WindowStyle.BORDER} text="A much longer label" style={{width:'auto', height:24}} />
|
|
174
|
+
</w>
|
|
175
|
+
<w type="STATIC" ws={VISIBLE} text="Mixed auto + fixed" style={{height:24}} />
|
|
176
|
+
<w type="STATIC" ws={VISIBLE} style={{flexDirection:'row', gap:8, alignItems:'stretch', height:30}}>
|
|
177
|
+
<Button style={{width:150, height:30}}>Fixed 150</Button>
|
|
178
|
+
<Button style={{width:'auto', height:30}}>Auto</Button>
|
|
179
|
+
</w>
|
|
180
|
+
</w>
|
|
181
|
+
|
|
182
|
+
{/* ===== Tab Demo ===== */}
|
|
183
|
+
<w type="STATIC" ws={VISIBLE} text="Tab" style={{height:24}} />
|
|
184
|
+
<Tab
|
|
185
|
+
tabs={[
|
|
186
|
+
{ title: 'Counter', content: (
|
|
187
|
+
<w type="STATIC" ws={VISIBLE | CLIPCHILDREN} style={{flexDirection:'column', gap:6}}>
|
|
188
|
+
<w type="STATIC" ws={VISIBLE} text={`Count: ${count}`} style={{height:24}} />
|
|
189
|
+
<Button onClick={() => setCount(c => c + 1)} style={{width:80}}>+1</Button>
|
|
190
|
+
</w>
|
|
191
|
+
)},
|
|
192
|
+
{ title: 'Typing', content: (
|
|
193
|
+
<w type="STATIC" ws={VISIBLE | CLIPCHILDREN} style={{flexDirection:'column', gap:6}}>
|
|
194
|
+
<Input value={inputText} onChange={setInputText} placeholder="Type here..." style={{height:28}} />
|
|
195
|
+
<w type="STATIC" ws={VISIBLE} text={inputText ? `You typed: ${inputText}` : '(empty)'} style={{height:24}} />
|
|
196
|
+
</w>
|
|
197
|
+
)},
|
|
198
|
+
]}
|
|
199
|
+
style={{height:120}}
|
|
200
|
+
/>
|
|
201
|
+
|
|
202
|
+
{/* ===== DateTimePicker ===== */}
|
|
203
|
+
<w type="STATIC" ws={VISIBLE} text={`DateTimePicker (${dtDate ? `${dtDate.getFullYear()}-${String(dtDate.getMonth()+1).padStart(2,'0')}-${String(dtDate.getDate()).padStart(2,'0')}` : 'none'})`} style={{height:24}} />
|
|
204
|
+
<w type="STATIC" ws={VISIBLE} style={{flexDirection:'row', gap:8, alignItems:'stretch', height:28}}>
|
|
205
|
+
<DateTimePicker value={dtDate} onChange={setDtDate} style={{flexGrow:1}} />
|
|
206
|
+
<DateTimePicker value={dtDate} onChange={setDtDate} format="long" style={{flexGrow:1}} />
|
|
207
|
+
<DateTimePicker value={dtDate} onChange={setDtDate} format="time" style={{flexGrow:1}} />
|
|
208
|
+
</w>
|
|
209
|
+
|
|
210
|
+
{/* ===== SysLink ===== */}
|
|
211
|
+
<w type="STATIC" ws={VISIBLE} text="SysLink" style={{height:24}} />
|
|
212
|
+
<w type="STATIC" ws={VISIBLE} style={{flexDirection:'row', gap:8, alignItems:'stretch', height:28}}>
|
|
213
|
+
<Link href="https://example.com" onClick={(url) => console.log('Link clicked:', url)} style={{flexGrow:1}}>
|
|
214
|
+
Example Link
|
|
215
|
+
</Link>
|
|
216
|
+
<Link href="https://github.com" onClick={(url) => console.log('Link clicked:', url)} style={{flexGrow:1}} />
|
|
217
|
+
</w>
|
|
218
|
+
|
|
219
|
+
{/* ===== PathPicker ===== */}
|
|
220
|
+
<w type="STATIC" ws={VISIBLE} text="PathPicker" style={{height:24}} />
|
|
221
|
+
<w type="STATIC" ws={VISIBLE} style={{flexDirection:'column', gap:6, height:130}}>
|
|
222
|
+
<PathPicker type="file" title="Select a file" style={{height:28}} />
|
|
223
|
+
<PathPicker type="folder" title="Select a folder" style={{height:28}} />
|
|
224
|
+
<PathPicker type="file" value={pickerPath} onChange={setPickerPath} title="Controlled" style={{height:28}} />
|
|
225
|
+
<w type="STATIC" ws={VISIBLE} text={pickerPath ? `Selected: ${pickerPath}` : '(none)'} style={{height:20}} />
|
|
226
|
+
</w>
|
|
227
|
+
|
|
228
|
+
{/* ===== 下半区: ListView + ScrollView + TreeView ===== */}
|
|
229
|
+
<w type="STATIC" ws={VISIBLE} style={{flexDirection:'row', gap:6, alignItems:'stretch', height:400}}>
|
|
230
|
+
<w type="STATIC" ws={VISIBLE | CLIPCHILDREN} style={{flexDirection:'column', gap:4, flexGrow:1}}>
|
|
231
|
+
<w type="STATIC" ws={VISIBLE} text={`ListView (${listData.length} items)`} style={{height:24}} />
|
|
232
|
+
<w type="STATIC" ws={VISIBLE} style={{flexDirection:'row', gap:6, alignItems:'stretch', flexGrow:1}}>
|
|
233
|
+
<ListView<Fruit>
|
|
234
|
+
columns={listCols}
|
|
235
|
+
data={listData}
|
|
236
|
+
style={{flexGrow:1}}
|
|
237
|
+
/>
|
|
238
|
+
<w type="STATIC" ws={VISIBLE | CLIPCHILDREN} style={{flexDirection:'column', gap:6, width:100}}>
|
|
239
|
+
<Button onClick={() => setListData(d => [...d, { name: 'NewItem ' + String(listData.length + 1), color: '', origin: '' }])} style={{height:28}}>
|
|
240
|
+
Add
|
|
241
|
+
</Button>
|
|
242
|
+
<Button onClick={() => setListCols(cols => [...cols, { name: 'Col' + (listCols.length + 1), dataIndex: 'name' as keyof Fruit }])} style={{height:28}}>
|
|
243
|
+
+Column
|
|
244
|
+
</Button>
|
|
245
|
+
</w>
|
|
246
|
+
</w>
|
|
247
|
+
</w>
|
|
248
|
+
<w type="STATIC" ws={VISIBLE | CLIPCHILDREN} style={{flexDirection:'column', gap:4, flexGrow:1}}>
|
|
249
|
+
<w type="STATIC" ws={VISIBLE} text="ScrollView (scrollable)" style={{height:24}} />
|
|
250
|
+
<ScrollView style={{flexGrow:1}} contentWidth={500} contentHeight={560}>
|
|
251
|
+
{Array.from({ length: 20 }, (_, i) => (
|
|
252
|
+
<w type="STATIC" ws={VISIBLE}
|
|
253
|
+
key={i}
|
|
254
|
+
text={`Item ${i + 1} - ${i === 0 ? 'here is a line so wide that the horizontal scrollbar appears for demonstration' : ''}`}
|
|
255
|
+
style={{width: i === 0 ? 500 : 200, height:28}}
|
|
256
|
+
/>
|
|
257
|
+
))}
|
|
258
|
+
</ScrollView>
|
|
259
|
+
</w>
|
|
260
|
+
<w type="STATIC" ws={VISIBLE | CLIPCHILDREN} style={{flexDirection:'column', gap:4, flexGrow:1}}>
|
|
261
|
+
<w type="STATIC" ws={VISIBLE} text={`TreeView (sel=${treeSel?.label ?? 'none'})`} style={{height:24}} />
|
|
262
|
+
<TreeView data={treeData} onSelect={setTreeSel} style={{flexGrow:1}} />
|
|
263
|
+
</w>
|
|
264
|
+
</w>
|
|
265
|
+
</w>
|
|
266
|
+
</ScrollView>
|
|
267
|
+
)
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const hwnd = gui.CreateWindow(
|
|
271
|
+
'Gallery', 'Component Gallery',
|
|
272
|
+
gui.WindowStyle.OVERLAPPEDWINDOW,
|
|
273
|
+
100, 100, 1400, 1200, null, null
|
|
274
|
+
)
|
|
275
|
+
|
|
276
|
+
if (hwnd) {
|
|
277
|
+
const cr = gui.GetClientRect(hwnd)!
|
|
278
|
+
const scale = gui.GetScaleFactor()
|
|
279
|
+
const svW = Math.round((cr.right - cr.left) / scale)
|
|
280
|
+
const svH = Math.round((cr.bottom - cr.top) / scale)
|
|
281
|
+
render(<App svW={svW} svH={svH} />, hwnd)
|
|
282
|
+
setTimeout(() => {
|
|
283
|
+
gui.ShowWindow(hwnd)
|
|
284
|
+
}, 0)
|
|
285
|
+
}
|