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
|
|
7 const config:FlexLayout.IJsonModel = {
|
|
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 {
|
|
33 constructor(props) {
|
|
34 super(props);
|
|
35 this.state = { model: FlexLayout.Model.fromJson(config) };
|
|
36 }
|
|
37
|
|
38 factory = (node) => {
|
|
39 var component = node.getComponent();
|
|
40 return e(component, null, "");
|
|
41 };
|
|
42
|
|
43 render() {
|
|
44 return e(FlexLayout.Layout, { model: this.state.model, factory: this.factory });
|
|
45 }
|
|
46 }
|
|
47
|
|
48 const root = createRoot(document.getElementById("container")!);
|
|
49 root.render(React.createElement(Main));
|