2374
|
1 import * as React from "react";
|
|
2 import { createRoot } from "react-dom/client";
|
|
3 import * as FlexLayout from "flexlayout-react";
|
|
4 export { Light9DeviceSettings } from "./live/Light9DeviceSettings";
|
|
5 export { Light9CollectorUi } from "./collector/Light9CollectorUi";
|
|
6
|
2382
|
7 const config: FlexLayout.IJsonModel = {
|
2374
|
8 global: {},
|
|
9 borders: [],
|
|
10 layout: {
|
|
11 type: "row",
|
|
12 weight: 100,
|
|
13 children: [
|
|
14 {
|
|
15 type: "tabset",
|
|
16 weight: 50,
|
|
17 children: [{ type: "tab", name: "devsettings", component: "light9-device-settings" }],
|
|
18 },
|
|
19 {
|
|
20 type: "tabset",
|
|
21 weight: 50,
|
|
22 children: [{ type: "tab", name: "collector", component: "light9-collector-ui" }],
|
|
23 },
|
|
24 ],
|
|
25 },
|
|
26 };
|
|
27
|
|
28 const e = React.createElement;
|
|
29
|
|
30 // see https://github.com/lit/lit/tree/main/packages/labs/react
|
|
31
|
|
32 class Main extends React.Component {
|
2382
|
33 state: { model: FlexLayout.Model };
|
|
34 constructor(props: any) {
|
2374
|
35 super(props);
|
|
36 this.state = { model: FlexLayout.Model.fromJson(config) };
|
|
37 }
|
|
38
|
2382
|
39 factory = (node: any) => {
|
2374
|
40 var component = node.getComponent();
|
|
41 return e(component, null, "");
|
|
42 };
|
|
43
|
|
44 render() {
|
|
45 return e(FlexLayout.Layout, { model: this.state.model, factory: this.factory });
|
|
46 }
|
|
47 }
|
|
48
|
|
49 const root = createRoot(document.getElementById("container")!);
|
|
50 root.render(React.createElement(Main));
|